Sign in to follow this  
beginnerfurqan

STOP

Recommended Posts

beginnerfurqan    136
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
stimarco    1071
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
Guest
This topic is now closed to further replies.
Sign in to follow this