PDA

View Full Version : collision detection in Alice 3.0


joethechicken
02-12-2012, 08:46 PM
Hi, has anyone here tried doing collision detection in the 3.0 beta? I am creating a maze game and every time I try to add some sort of collision detection to the code, there is either major lag or an error report or both.
Help will be greatly appreciated.


My current code involves getting the distance between the character that is being controlled and a wall.
Then, "if statement" the distance is greater than 0, the character can be turned left and right, and it can be moved forwards, using the arrow keys ("do together").
Each time, it moves, it gets the distance between the wall and the character.
"Else part of if statement" the character moves backwards the same distance that it had just moved forwards and says "I can't walk through walls."
However, after I run the program, each time the character moves, there is an error message.
When I tried looping the if statement, the same thing happened and the character became a lot more difficult to control.