PDA

View Full Version : Key stroke to change a variable in a method


pancaks
12-02-2009, 05: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.

x2495iiii
12-02-2009, 05: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.

pancaks
12-02-2009, 06:23 PM
I figured that was how it worked, but I can't seem to drag the variable tile to the method.

kylefwlr
12-02-2009, 09: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