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
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
P.S Hope to be of help!
For (i = 0; i < MAX_NUMBER_SHIPS; i++)
{
if (Ship.x > SCREEN_LEFT_POS && Ship.x < SCREEN_RIGHT_POS && Ship.y > SCREEN_TOP_POS && Ship.y < SCREEN_BOTTOM_POS)<BR> {<BR> Draw_Sprite(Ship);<BR> }<BR> }<BR></code><P>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. . .<P> <BR>
Get off my lawn!
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).]