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

Username:   Password: 
 RegisterRegister   
 Collision Detection Help [Boxes Touching]
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
LunarCP




PostPosted: Fri May 22, 2015 11:14 am   Post subject: Collision Detection Help [Boxes Touching]

Okay, so I am trying to make a maze type game where a character has to grow through a maze to the finish line, and when they touch certain boxes, it will set them back to the beginning.

The beginning would be 0,0 in this case.

So, here are the 2 boxes for example:

Draw.FillBox (200, 0, 250, 100, black)
Draw.FillBox (x1 - 1, y1 - 1, x2 + 1, y2 + 1, white)


The white box would be the character, which the movement is controlled by keys meaning that the x1, y1, x2 and y2 variables can be changed.

How would I stop the two from being able to touch?

Here is the code from my whole project I'm working on if you want to get a general idea!

http://pastebin.com/1PTNppAa

Any suggestions you have to make it a better game would be helpful! I am also looking into a simple way to make it generate the boxes in random spots so that they can go through several different levels.
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Fri May 22, 2015 4:26 pm   Post subject: RE:Collision Detection Help [Boxes Touching]

There are plenty of collision detection tutorials here, either use the search button at the top of the page or look through the Turing Walkthrough.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: