Hi a am in code trouble yet again and i need help with the radar (sometimes referred to map in rts games such as Age of empires)
Radar
Blitz3D Forums/Blitz3D Beginners Area/Radar I guess the simpiest way to actually do a "radar" is to do like this. This is just a concept and not actual code so must translate it into your own code:
Create an empty image which will be the map.
RadarXSize = 80
RadarYSize = 80
PointX = (UnitXPosition/MapXSize)*RadarXSize
PointY = (UnitXPosition/MapXSize)*RadarXSize
Choose a nice colour for your unitpixel and:
Plot (PointX,PointY)
You will do exactly the same with all important radardata (buildings, environment) but some of this must not be updated all the time (maybe even once a game).
Hope you understand the concept beause it's actually harder to give you a working code as we don't know what your code looks like so far.
Plot (PointX,PointY)
Create an empty image which will be the map.
RadarXSize = 80
RadarYSize = 80
PointX = (UnitXPosition/MapXSize)*RadarXSize
PointY = (UnitXPosition/MapXSize)*RadarXSize
Choose a nice colour for your unitpixel and:
Plot (PointX,PointY)
You will do exactly the same with all important radardata (buildings, environment) but some of this must not be updated all the time (maybe even once a game).
Hope you understand the concept beause it's actually harder to give you a working code as we don't know what your code looks like so far.
Plot (PointX,PointY)
load images like this:
use them like this:
Also, this should be in your main loop, as you probably want the radar updated every frame, but however you don't need to load the image every time you use it... just once. So your overall code should be something like this:
...or something to that effect. Hope that helps!
image = LoadImage("Cruise missile.bmp")
use them like this:
DrawImage image, PointX, PointY
Also, this should be in your main loop, as you probably want the radar updated every frame, but however you don't need to load the image every time you use it... just once. So your overall code should be something like this:
;Before the main loop... radarImage = LoadImage("radar.bmp") cruiseMissileImage = LoadImage("cruise missile.bmp") RadarXSize = 80 RadarYSize = 80 ;somewhere in your main loop... PointX = ("cruisemissile"/MapXSize)*RadarXSize PointY = ("cruisemissile"/MapXSize)*RadarXSize DrawImage radarImage, 0, 0 DrawImage cruiseMissileImage, PointX, PointY
...or something to that effect. Hope that helps!
I knew about the load image stuff but I was focusing on the radar portion of the code btw