How to turn the light off ?

Get help using Construct 2

Post » Fri Dec 13, 2013 7:08 am

Hello World,
I am trying to get the hang of this program and am stuck on how to change a 2 frame animation back to frame 0 after a left mouse click,

ie, the light comes on in frame 1 and gets stuck.
thanks.
B
13
S
4
Posts: 60
Reputation: 1,001

Post » Fri Dec 13, 2013 7:29 am

Condition:
-On left click on "LightObj".
Action:
-Set "LightObj" Animation Frame to (Frame Number).
--"LightObj" Stop Animation.
B
17
S
8
G
4
Posts: 93
Reputation: 3,190

Post » Fri Dec 13, 2013 7:42 am

[QUOTE=c4sp3r89] Condition:
-On left click on "LightObj".
Action:
-Set "LightObj" Animation Frame to (Frame Number).
--"LightObj" Stop Animation.
[/QUOTE]
thanks for helping ,
this gets me to frame 1 but not back to frame 0 when I click it again,
B
13
S
4
Posts: 60
Reputation: 1,001

Post » Fri Dec 13, 2013 7:56 am

Oh..

You need to add a instance variable to the "LightObj". Maybe call it "Power"(Type is Number, Default 0).

So on start of the app, Lights is off (I assume off is frame 0 and on is frame 1)

So on mouse click,
check "LightObj" variable "Power" is = 0?
If yes, set "Power" to 1 and Frame to 1 (its on now).
else
If no, set "Power" to 0 and Frame to 0 (its off now).

something like this.
B
17
S
8
G
4
Posts: 93
Reputation: 3,190

Post » Fri Dec 13, 2013 7:59 am

Is your animationspeed set to 0?

Condition:
-On left click on "LightObj".
--subevent:
-if Lightobj animationframe = 0
-action:
--Set "LightObj" Animation Frame to (1).
--system else
--Set "LightObj" Animation Frame to (0).
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Dec 13, 2013 5:26 pm

Thank you LittleStain n c4sp3r89, #SUBEVENTS not another condation.
B
13
S
4
Posts: 60
Reputation: 1,001


Return to How do I....?

Who is online

Users browsing this forum: sublimate and 10 guests