How does Every XXX second work

Get help using Construct 2

Post » Mon Jul 07, 2014 8:21 pm

I have something like code in attachment.

I have 3 instances of an object on layout and I want to move (play animation from beginning) particular one in different moment of game.

After first 15 seconds move instance with ID 1 after 40 move instance with ID 2 and after 70 move instance with ID 3.


Last condition Animation frame = 0 ensures that animation will be played only once.

It works first time first object with ID 1 is played after 15 second second after 40 seconds and third after 70.
But when I go to other layout and then return all events Every 15 second, Every 40 second and Every 70 second are fired at the beginning. What is wrong ?
You do not have the required permissions to view the files attached to this post.
B
9
S
2
G
1
Posts: 50
Reputation: 742

Post » Mon Jul 07, 2014 8:28 pm

I'm not sure on that, but probably the timer is still running when you change layouts and once you go back the event is waiting there ready to trigger.

You could use the timer behaviour to do this, start the timer 'on start of layout', then on timer finished event do whatever you need to do.
Please tag me with @caiorosisca if your post is refering to me :). I don't always follow the topics I answer.
B
11
S
4
G
1
Posts: 272
Reputation: 1,643

Post » Tue Jul 08, 2014 7:13 pm

THX, it works with timer behavior.
B
9
S
2
G
1
Posts: 50
Reputation: 742


Return to How do I....?

Who is online

Users browsing this forum: AndreasR, Casimir, David181 and 18 guests