The logic for this sounded very easy in my head. But I can't get it to work like I want (or at all for that matter).
I want to create a flashlight that I can toggle on and off with the F key.
I have the flashlight object set to invisible from the start.
Here's the logic.
--> Global number FlashlightOn = 0 (this represents 'off')
Event 1 - If Flashlight is Off:
Condition 1 - If FlashlightOn = 0
Condition 2 - If 'F' key is pressed
Action 1 - Set "flashlight" object to visible
Action 2 - Set FlashlightOn value to 1 (this represents 'on')
Event 2 - If Flashlight is On:
Condition 1 - If FlashlightOn = 1 ("On")
Condition 2 - If 'F' key is pressed
Action 1 - Set "flashlight" object to invisible
Action 2 - Set FlashlightOn value to 0 ("Off")
Without the second event (which I have a feeling is unnecessary), I'm able to get the flashlight to turn on. But I'm not able to toggle it off afterwards.
Here's the event sheet:
<img src="http://i.imgur.com/PSnCtN9.jpg" border="0" />
Thanks for any help! I'm sure this is an easy thing to do. But I'm still new to C2!