Posted: Wed Dec 28, 2011 5:50 pm Post subject: help Traveling along a border collision
What I am trying to accomplish is to make the red box, which is controlled by the player, able to move only along the most outward lines (dotted in red).
It should not be able to cross the dotted red line. At an intersection (corner), it should only be able to have 2 choices of movement.
For example, if it was the bottom left corner, it should only be able to travel either in the up direction or right direction.
What I have right now is detecting which type of line the player is currently on with boolean values. (vertical or horizontal line).
if onVertical and onHorizontal are true, meaning that it's at an intersection, how would i be able to detect which corner it is?
Sponsor Sponsor
Tony
Posted: Wed Dec 28, 2011 5:56 pm Post subject: Re: help Traveling along a border collision
tyuo9980 @ Wed Dec 28, 2011 5:50 pm wrote:
detect which corner it is?
From the direction of the previous move. That is, if the square moved "right" and ended up at an intersection, then it must have approached from the "left" side.
Posted: Wed Dec 28, 2011 5:58 pm Post subject: Re: help Traveling along a border collision
i have thought about that, but for example, if you are moving up and reach an intersection, there could be two corner possibilities, either top-left or top-right.