Alice Community

Alice Community (
-   How do I...? (
-   -   While __ is pressed and stopping a loop? (

mevogy 04-18-2010 08:52 PM

While __ is pressed and stopping a loop?
In the example world flightSimulator, some of the events it has is "while arrow is pressed....", how did they do this?

Also, I have made a world where if this character gets close to another object, the object moves the distance to the character (through looped "object distance to character"). How could I end this loop when the character hits the object with something? The character may not always hit the object, and if it doesn't, I still want it to reach the character.
Hope that all made sense, thanks for any help.

Niteshifter 04-18-2010 09:14 PM

1. You drop in the "when a key is pressed" event, right click it and go change to > "while a key is pressed".

2. Using a while loop with the condition "object1 distance to object2 < X" where 'object1' and 'object2' are two separate objects and 'X' is a number of how far you want the objects to be before the while loop ends.

All times are GMT -5. The time now is 05:33 PM.

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