I should add the ships, stations and planets etc. to the map. How can I do that?
Do I have to do another map layer, and if, how do I do that?
Then when you draw them you just draw the map, then check all the objects to see if they are on screen.
Thats what I do at least for RTS games, but the checks arent unreasonable.
-Geoff
For (i = 0; i < MAX_NUMBER_SHIPS; i++)
{
if (Ship[i].x > SCREEN_LEFT_POS && Ship[i].x < SCREEN_RIGHT_POS && Ship[i].y > SCREEN_TOP_POS && Ship[i].y < SCREEN_BOTTOM_POS)
{
Draw_Sprite(Ship);
}
}
I just did that from my head and didn't really check it over, but you get the point. An array of ships and you check if their on the screen using a for loop. . .
anyway it should look something like this. (not checked)
if (Ship(i).x > SCREEN_LEFT_POS and Ship(i).x < SCREEN_RIGHT_POS and Ship(i).y > SCREEN_TOP_POS and Ship(i).y < SCREEN_BOTTOM_POS then
for i = 0 to MAX_NUMBER_SHIPS-1
Draw_Sprite(Ship(i))
end if
next
[This message has been edited by STG (edited December 21, 1999).]
[This message has been edited by STG (edited December 21, 1999).]
[This message has been edited by STG (edited December 21, 1999).]
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more