• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

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