Computer Science Canada collision detection help |
Author: | wargamer17 [ Wed Apr 11, 2007 4:22 pm ] | ||
Post subject: | collision detection help | ||
I am trying to make my own version of the classic game Haunted House from the Atari 2600. Currently, I am trying to work on collision detection for the walls, but since it has multiple rooms, I am going to have many walls. For collision detection so far, I have been doing this:
Although this works for collision, I would have to do that for each wall. Is there any way I could use one piece of code like that for multiple walls, such as like a check to see if that wall is hit, then do the code for that wall? Maybe with a boolean? Maybe with colour detection so that if the player, the background, and the wall are different colours, and the player hits a certain colour(in this case blue for the wall) then it would stop as if it collided? This is what i have been troubled with. I think that as soon as I get collision detection working properly, I can finally get moving on this project. |
Author: | wargamer17 [ Fri Apr 13, 2007 9:15 pm ] | ||
Post subject: | Re: collision detection help | ||
Well, i've been working on more tests for collision detection, and was able to get this:
It is working, except after the collision, i want the character to stop. So far, it recognizes a collision, and counts down health. |