This project has moved. For the latest updates, please go here.

How to detect stuffs are out of edge?

Topics: Developer Forum, Project Management Forum, User Forum
Dec 21, 2012 at 4:00 AM

I want to design something like this

when the small ball runs out of edge, game is over

i don't know how to detect this


I am fresh man in game design...simple explanation pls

thank you very much

Dec 21, 2012 at 4:16 AM

The simplest way of doing it, is to do a simple plane check:

if (ball.Y < -30)
   //Ball is below the line
   //Ball is above the line

The -30 (meters) determine where in the world the threshold should be on the Y-Axis. Imagine a screen with (0,0) as the center of the screen:

Y= 20  |                                         |
Y= 10  |                                         |
Y= 0    |                                         |
Y= -10 |                                         |
Y= -20 |                                         |

Then Y = 30 is below the screen, and you simply check if the ball has a Y coordinate below the screen.

Dec 21, 2012 at 4:30 AM

Thank you


Do I need to define the "Y"? Is it already defined in Farseer?

Dec 22, 2012 at 2:19 AM

Y is referring to the Y component in a coordinate. I just did not want to write (x,y=20).