#### Archived

This topic is now archived and is closed to further replies.

# How do I create a endless circular map?

This topic is 6187 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I''m writing a space shooter game where your ship flys around and shoots other ships. On the bottom there is a map showing the location of all the ships, including yours. I need to make it so the ship can reach the end of the map on one side and wrap around to the other side. I was thinking of making it so when your ship reached one side it''s x pos would be brought back to the otherside, but then the other ships would also have to move if they were on the screen at the time of the move. The game is going to be simmilar to the game Aquatron if that helps anybody.

##### Share on other sites
Well.... I don''t know how are you implementing it but is not that dificult...

when your map reaches the edge of the map (say the right edge) you just have to start drawing the left part of the map...

I don''t see any problem with any ships anywhere... (?)

nice day

jakovo

##### Share on other sites
The map consists of 32 sections each representing 1 screen width. The game is running at 800x600, so the total width of the playing area is 25600 pixels. When the ship reaches that point I could put the ship back at 0 for an x posistion, but when the ship moves back to 0 any other ships that were on screen at the time, but have not crossed the right edge of the map, would not be drawn on the screen after you crossed the edge. Is there another method of doing this?

##### Share on other sites
I''m assuming, that since your whole map is bigger than your screen, you''re just following the ship around, and that ship is always drawn in the middle of your screen. Well, how do you currently determine whether or not to draw the other stuff? You check to see if it''s near you right, or are you just drawing everything?

Basically, you want to see if a ship is within ''sight'', in your case within 400 horizontal units and 300 vertical units...if it''s within that box, draw it. So if you''re on one end of the map, and the ship is on the other, you can just add the map size to your location, or subtract the map size from the other ship.

Ship.X -> 100, Enemy.X-> 25500

Ship.X += 25600 -> 25700, which is only 200 away from the Enemy, so draw it 200 units away from you...

I had to do this years ago for an asteroids game a few years back...easy stuff ; )

G''luck,
-Alamar

1. 1
Rutin
24
2. 2
3. 3
JoeJ
20
4. 4
5. 5

• 9
• 46
• 41
• 23
• 13
• ### Forum Statistics

• Total Topics
631749
• Total Posts
3002031
×