Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
movement specific to one method
Old
walleyewilly
Junior Member
 
walleyewilly's Avatar
 
Status: Offline
Posts: 9
Join Date: Mar 2012
Location: youngstown
Default movement specific to one method - 04-10-2012, 10:16 AM

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
   
Reply With Quote
Old
dakota95
Senior Member
 
dakota95's Avatar
 
Status: Offline
Posts: 426
Join Date: Aug 2011
Location: like I would tell you. ;)
Default 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.


<Insert_Signature_Here>
   
Reply With Quote
Old
walleyewilly
Junior Member
 
walleyewilly's Avatar
 
Status: Offline
Posts: 9
Join Date: Mar 2012
Location: youngstown
Default 04-11-2012, 02:17 PM

Thanks, I'll give that a try. Willy
   
Reply With Quote
variables
Old
walleyewilly
Junior Member
 
walleyewilly's Avatar
 
Status: Offline
Posts: 9
Join Date: Mar 2012
Location: youngstown
Default variables - 04-13-2012, 08:04 PM

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
   
Reply With Quote
Reply

Tags
key movement, method

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



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