Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Collision Detection
Old
Lucifera
Guest
 
Status:
Posts: n/a
Default Collision Detection - 02-26-2009, 11:17 AM

i need my ninja not to walk through walls. Any ideas?
   
Reply With Quote
Old
JustasM
Guest
 
Status:
Posts: n/a
Default 02-26-2009, 11:53 AM

There are several worlds that are shared that employ collision detection. For example, check out the JetStix world in the Madden games thread.

http://www.alice.org/community/showt...?t=1159&page=2

Usually, you do collision detection by using proximity functions: If the object you are moving is within e.g. 1 meter of 'wall', set the object's speed to 0/ decrease speed/ move backward.

Try and experiment a bit, or simply look at someone else's code and imitate it.. You're allowed to do that!

Good luck!

*EDIT*
Or, simply, under the events tab, 'let arrow keys move object', if that is applicable to your world. It will prevent the object from moving through walls.

However, beware: the object is able to move through walls and objects if it is moving backwards, so it can be exploited in certain worlds/games. Collision detection works, for certain reasons, only during forward movement.

Last edited by JustasM; 02-26-2009 at 11:57 AM.
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2021, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.