Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 help Traveling along a border collision
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
tyuo9980




PostPosted: Wed Dec 28, 2011 5:50 pm   Post subject: help Traveling along a border collision

Posted Image, might have been reduced in size. Click Image to view fullscreen.

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
Sponsor
sponsor
Tony




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
tyuo9980




PostPosted: 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.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: