Sign in to follow this  

STOP

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi guys, in my program, i have objects travelling from one side to another. the problem is after reaching the opposite side the object just goes off the screen. i would prefer the objects to either stop and travel back in the direction it came from or come around again from the initial side of the screen. can anyone help please? cheers

Share this post


Link to post
Share on other sites
Quote:
Original post by beginnerfurqan
hi guys,
in my program, i have objects travelling from one side to another. the problem is after reaching the opposite side the object just goes off the screen. i would prefer the objects to either stop and travel back in the direction it came from or come around again from the initial side of the screen. can anyone help please? cheers


Presumably, you're adding or subtracting a value from each object's coordinate(s) to make them move in the first place. All you have to do is check their (screen -- not world) coordinates and see if they've reached the edge of the screen. If so, stop changing their coordinates.

You may want to look up "collision detection" in whatever relevant documentation or books you're using to find out more.

Share this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Guest
This topic is now closed to further replies.
Sign in to follow this