Alice Community  

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

Reply
 
Thread Tools Display Modes
How do I not walk through walls?
Old
pAche88
Guest
 
Status:
Posts: n/a
Default How do I not walk through walls? - 03-08-2007, 01:46 PM

I've been trying to make my character not walk through buildings and trees but havnt been able to figure out how to do it. anyone know?
   
Reply With Quote
Old
ottosparks
Senior Member
 
ottosparks's Avatar
 
Status: Offline
Posts: 117
Join Date: Mar 2007
Location: here
Default 03-08-2007, 02:51 PM

Put an If/Else and make a method that makes it stop
Example:
If [Navy Jet is {1.3} meters away from {Factory}]
Do
-Navy Jet.crash-
Else
(Do Nothing)


I'm more lopsided than a three-legged badger!
   
Reply With Quote
Old
pAche88
Guest
 
Status:
Posts: n/a
Default 03-09-2007, 02:15 PM

and how would i make the method that stops the character?
   
Reply With Quote
Old
DrJim
Guest
 
Status:
Posts: n/a
Default 03-09-2007, 07:17 PM

Lots of examples in the forum - the exact details will depend on what you are trying to stop the object from going through. On place to start is the thread http://www.alice.org/community/showt...highlight=maze . Also, as suggested there, do a search on "collision".

In any case, you will have to use one of Alice's relative distance functions like ottosparks suggests. Again - that's pretty well covered in the thread. In all cases, however, the distances are measured to the center of an object, not an edge so for large objects you will have to be careful how you set up your conditional statements. For walls, etc. - "in front of", "behind" and "to the right/left of" can be more usefull than simply "distance to" or "within a threshold of".

Either if statements and loops or while statements work fine - the while statement is generally easier to set up. There are several examples like that in the texts.
   
Reply With Quote
Old
ottosparks
Senior Member
 
ottosparks's Avatar
 
Status: Offline
Posts: 117
Join Date: Mar 2007
Location: here
Default 03-19-2007, 05:33 PM

Quote:
Originally Posted by pAche88 View Post
and how would i make the method that stops the character?
I'll give you an example


I'm more lopsided than a three-legged badger!
   
Reply With Quote
Old
Pop Alexandra
Junior Member
 
Status: Offline
Posts: 4
Join Date: Aug 2017
Default 04-12-2019, 02:46 AM

Has this bug been fixed? What needs to be tweaked?
__________________________________________
Alexandra from Agro
   
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 ©2019, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.