View Single Post
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 978
Join Date: Sep 2009
Location: United States
Default 02-20-2010, 10:37 PM

well you can just make a boolean variable within the world (do not make it in the method itself) and call it nightVisionOn. It could initially be turned to false, but then when you click a button (lets say space) it runs the method enableNightVision.

Within this method you can have an if/else statement saying (if(nightVisionOn)) and then in that if you make the method to turn it off, and then in the (else) you can have the method to turn night vision on. At the end of the if statement, you simply add a command to turn nightVisionOn == false, and then at the end of the else statement have nightVisionOn == true.

Now every time you run the method, depending if nightVisionOn is true or false, it will have a distinct method, but both will be triggered by pressing the space bar. If you need more help, just ask and I will create a world with the example.


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote