Timers and instance variables

Get help using Construct 2

Post » Mon Nov 17, 2014 4:01 am

Hi, this is probably something really basic - I've got a sprite with the timer behaviour attached and an instance variable that is meant to control the timer on a per-instance basis. The timer toggles a boolean variable which in turn switches between a frame on the sprite. I want these to switch on and off at different rates dictated by the instance variable blinktime. When I test the layout, at first it appears to work - I have 3 instances set up with 1, 2 and 3 set up for the blink time and each one blinks on as needed - but instead of looping on and off at the designated time, the instances then seem to sync and the timing goes a bit weird. Can anyone take a quick look at this and let me know what I'm doing wrong? I figure it's something to do with "for each" but I can't quite put my finger on it.

link to capx
https://dl.dropboxusercontent.com/u/703 ... inker.capx
B
64
S
25
G
4
Posts: 204
Reputation: 6,993

Post » Mon Nov 17, 2014 4:53 am

I think this works ok
blinker_codah.capx


edit: slight variant
blinker_codah_2.capx
You do not have the required permissions to view the files attached to this post.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Mon Nov 17, 2014 8:20 am

Thanks heaps! Works like a charm. :)
B
64
S
25
G
4
Posts: 204
Reputation: 6,993

Post » Mon Nov 17, 2014 9:04 am

Cool. Sorry for the lack of explanation, but TBH it stumped me for a bit. What I expected to work, didn't. Bit of trial and error in the end I admit.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596


Return to How do I....?

Who is online

Users browsing this forum: Bootfit and 10 guests