How do I restart layout after a collison of 3 seconds

Get help using Construct 2

Post » Mon Sep 07, 2015 11:27 am

Hello, I want to create an event where it restarts the layout after sprite1 and sprite2 collide/overlap for 3 seconds.
I know how to get it to restart after the instant collison but dont know how to make it only restart after 3 seconds.
thanks
B
9
S
3
G
2
Posts: 53
Reputation: 1,789

Post » Mon Sep 07, 2015 11:42 am

Using the timer behaviour would work..

Sprite1 on collision with sprite2
> start timer for 3 seconds

sprite1 is not overlapping sprite2
> stop timer

on timer
> restart layout
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 » Mon Sep 07, 2015 11:45 am

Quick one from the top of my head.

Create "collisionTime" variable. When objects collide start counter, and add 1 to "collisionTime" every second. If collision breaks then clear "collisionTime" if not then restart layout when counter = 3.
ImageImageImage
B
31
S
19
G
82
Posts: 1,039
Reputation: 46,207


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests