Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   movement specific to one method (http://www.alice.org/community/showthread.php?t=8339)

walleyewilly 04-10-2012 10:16 AM

movement specific to one method
 
Hi guys:

I would like to create a scene in which the user is asked to press a key to move after the initial scene that will trigger another scene. When I create this in the event handler it seems that it can be used anytime during the running of the program. Is there a way to limit the use of a key to one method only? I am new to Alice and programming. Thanks, Willy

dakota95 04-11-2012 08:52 AM

use a number variable. make it so that at the end of one of your methods it changes the number to "5(it doesnt matter which number)" then make a movement method that says "'if' number variable is '5' then move wherever" then at the end of this movement tell it to change the number variable to "6(it just has to be different than the other number i.e. 5)" The way it will work is that as soon as the method is over the variable will make it so that you can move. But as soon as you move then the variable will be different that the "if/else" statements requirements making it so that you cannot move.

walleyewilly 04-11-2012 02:17 PM

Thanks, I'll give that a try. Willy

walleyewilly 04-13-2012 08:04 PM

variables
 
Hi Dakota:

I am experimenting with the variables as you instructed and I can tell I'm on the right path, but I still am a bit confused. I created a world number variable of 1. I then wrote an if/else statement in which when the variable changes to 2 and triggers another method, else repeat the current method. Then in event handler i set key to trigger the variable to change to 2. However, even when the variable has moved beyond the variable of two later in the program, I can still hit the prior event handler key and it will retrigger the former method. What am I doing wrong. Also what is the difference between incrementing a variable by some number and just setting that variable to a number. Thanks, Willy


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

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