#### Archived

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

# how to do roundabout movement?

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

## Recommended Posts

I''m looking for away to create ''round a bout'' movement. What I mean with that is that if player keeps moving in one direction, he will eventually return to his starting point. I''d like this in both directions (it''s essentially a 2d game). But I don''t really want a spherical world. Because is that was the case, if the players all started on the midian, and all the players went up, the would all converge at the top of the sphere, and I don''t want that. Any ideas, or places where I could find more information? Tnx

##### Share on other sites
Make a toroidal world. Just check if the player''s X or Y coord exceeds a certain minimum or maximum, if so then invert them. EX: World (-320,-200)-(320,200); Player position (319, 140); If on the next step the player moves two units along the positive X-axis, then the player''s new position should be (-319, 140).

##### Share on other sites

Yes I''ve thought of that. That''s even the way I have it programmed now.

The problem with that is this:
(the game is a kind of top down space shooter)

if my ship, and another ship are next to each other near the edge of the world, and I go over the edge (and get ''transported'') to the other side of the game world, the other ship suddenly disappears (because it''s still at the other end of the ''galaxy''). So I can''t shoot it anymore. Is there a way out of this that doesn''t make me have to create two instances of that other ship (one at it''s original position, and one offset by the size of the galaxy, so I see it at my new position)?

##### Share on other sites
Creative rendering.

You will need to make it look like Pacman in terms that your character can move from the left side to the right side.
You will also need to make it look seemless, so that when your character does appear on the other side, it isn''t a jumpy movement, like in Starfox 64''s muliplayer mode.

In Starfox 64, there is a fog to kind of hide this effect, but it was really obvious when the player you were following would pop out and then pop back into view.

You need to have your rendering engine realize when it is at the edge of the world and start to render from the other side.
You will need your regular game engine to realize when someone is at the edge of the world and make sure they can easily move from one end to the other.

This gets complicated when you are at a corner of your world though...If you were in the north-west corner of the world, you will need to render the south-east sections as well...
Imagine:

 1____________|0            |0|             ||             ||             ||             ||_____________| 1

Now you will need to render how it looks at the top left immediate area and to the left of that. The tough part is if you have to render more than one of those areas. You would have to create the map correctly as well.