Pausing an event for x seconds

For questions about using Classic.

Post » Fri May 08, 2009 2:17 pm

If I would want to unhide and hide a sprite for, say, 2 seconds, what would be the most efficient way to do this in Construct?

All I can think of is making a counter, which counts down:
Counting? (still) show sprite.
Stopped counting? hide sprite.

What is your suggestion?
B
16
S
5
G
7
Posts: 599
Reputation: 5,000

Post » Fri May 08, 2009 2:40 pm

Use the function object's Call Function After Delay, eg:

+ Any key pressed
-> Make sprite visible
-> Call function "make_invisible" after 2000ms

+ On function "make_invisible"
-> Make sprite invisible
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,518

Post » Fri May 08, 2009 10:18 pm

Whoa I've been using timers for that and it's kind of a hassle.
Thanks!
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Sat May 09, 2009 1:20 pm

Thanks. So far I'm now only using a function, only to be able to delay something.
B
16
S
5
G
7
Posts: 599
Reputation: 5,000

Post » Sat May 09, 2009 1:25 pm

The Timer Behavior is a better option if you have multiple instances of objects being timed; saves you using private variables or other methods.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Sat May 09, 2009 1:47 pm

I will keep that in mind.
B
16
S
5
G
7
Posts: 599
Reputation: 5,000


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests