Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   How do I not walk through walls? (http://www.alice.org/community/showthread.php?t=668)

pAche88 03-08-2007 12:46 PM

How do I not walk through walls?
 
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?

ottosparks 03-08-2007 01:51 PM

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

pAche88 03-09-2007 01:15 PM

and how would i make the method that stops the character?

DrJim 03-09-2007 06: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 [url]http://www.alice.org/community/showthread.php?t=250&highlight=maze[/url] . 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 [B]measured to the center of an object,[/B] 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.

ottosparks 03-19-2007 04:33 PM

[quote=pAche88;2404]and how would i make the method that stops the character?[/quote]
I'll give you an example

Pop Alexandra 04-12-2019 01:46 AM

Has this bug been fixed? What needs to be tweaked?
__________________________________________
Alexandra from [URL="https://revetementagro.com/"]Agro[/URL]


All times are GMT -5. The time now is 06:08 AM.

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