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 make an object do something different if clicked on twice? (http://www.alice.org/community/showthread.php?t=7197)

bobsaget219 09-09-2011 08:22 AM

How do I make an object do something different if clicked on twice?
 
Im doing a project and ive only been working with Alice for about 5 days and the project goes like this: I need to make a scene where a scientist turns green when a lever is pulled once, then when the same lever is pulled again, the scientist returns to normal color. I was wondering how can I make the lever do a different command than the first one (turn him into normal instead of staying to green and doing both commands at once)

x08 09-10-2011 03:44 AM

Use a variable and an if statement.

DensetsuNoKaboom 09-10-2011 07:57 AM

To clarify a bit:

Make a new Boolean variable, and set its value to false. Then add an if/else statement that says, if the variable is true, set the scientist's color to normal AND set the variable to false, else set the scientist's color to green AND set the variable to true.

bobsaget219 09-12-2011 08:35 AM

im still having a little trouble. Here's what I got:
T/F variable=False
If=true
World.2nd lever touch (when he turns to normal color)
Variable set value to false
Else
lever.mount.handle turn forward .25 revolutions
mad scientist set color to green
Variable set value to true

Hope this helps a bit

GameKid 09-18-2011 05:45 PM

As denetsu said in another thread, you have to make the variable world-wide.
Select World and go to properties. Click the button that says "Create new variable". Use that variable instead of a variable made in a method.

adams34 09-25-2011 11:10 AM

Make a new Boolean variable, and set its value to false. Then add an if/else statement that says, if the variable is true, set the scientist's color to normal AND set the variable to false, else set the scientist's color to green AND set the variable to true.


All times are GMT -5. The time now is 01:53 PM.

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