Alice Community  

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

Reply
 
Thread Tools Display Modes
Key stroke to change a variable in a method
Old
pancaks
Guest
 
Status:
Posts: n/a
Default Key stroke to change a variable in a method - 12-02-2009, 04:03 PM

Hey, appreciate all the help from you guys, just one question left for completion. I have the concept down, but I'm not sure how to implement changing the boolean value of a variable when a key is pressed within the method. Thanks in advance.
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 12-02-2009, 04:08 PM

Drag the boolean variable's tile to the "When a key is typed" method and select the value you want it to be set to.

If you want it to be true while the key is held, add a set value to true statement to the beginning and during parts of the event, and a false at the end.

If you want it to be true when it's pressed once, then false when it's pressed again, make an if statement which checks to see if it's true. If it's true, set it to false, else, set it to true.


(')>
   
Reply With Quote
Old
pancaks
Guest
 
Status:
Posts: n/a
Default 12-02-2009, 05:23 PM

I figured that was how it worked, but I can't seem to drag the variable tile to the method.
   
Reply With Quote
Old
kylefwlr
Guest
 
Status:
Posts: n/a
Default 12-02-2009, 08:24 PM

i think he means to make a method that changes the value of the variable, that or open an empty method, make a set variable to function, then drag that function into the tile
   
Reply With Quote
Reply

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 ©2019, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.