Jump to content
  • Advertisement
Sign in to follow this  
beginnerfurqan

STOP

This topic is 4615 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
Advertisement
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 4615 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  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!