Over Under Line

T

The Little Game Dev

Guest
Is there any way to check if an object is over or under a set line?

I'm needing this for an isometric game so the starting y and x are different from the ending y and x. I know how to use collision_line but I need to check if the object is above or under that collision
 
Last edited by a moderator:
The implementation depends on the complexity. If it's a simple line going across the x axis, then just check for the y coordinates. If an object's y is greater than the y's line, it's under, and vice versa. Anything deeper than this and you'll have to explain further how your system works.
 
A

Andy

Guest
You need to know the y for the object you are checking, and the y of the line.
Code:
if (y < line.y) // If object y is less than line y
{
    // above line
}
else
{
    // below line
}
 
Top