Delay 2 "collision" events on the object

Get help using Construct 2

Post » Wed Feb 20, 2013 8:18 pm

// Sory 4 bad engliish

I'm trying to make a "brick breaking" games, and I'm facing some balls breaker problem.

What i want to do :

In order to break one particular type of brick, the player must make the ball collide with it twice in 4 secondes.

So the ball collide with the brick, and then he has 4 secondes to make the ball collide with it a seconde time to kill it.


What i tried :




I know it seems too complex for what I try to do but I tried a lot of simpler options and this one is the only one that seems to work half the time.

The problem :

Half the time, the brick die on the first hit.
I don't get it, and i think a could use a fresh look on what i've done.
B
14
S
5
G
4
Posts: 15
Reputation: 3,794

Post » Wed Feb 20, 2013 8:28 pm

time expression - counts from the begining of your game, not when event triggers

You need to make a custom timer for that brick.
Make an instance variable for that brick called "timer" and set it to 4

When your ball hit this brick for first time, set timer to subtract 1*dt and then check if another hits are within timer limit - between 0 and 4.
shinkan2013-02-20 20:29:15
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Wed Feb 20, 2013 8:35 pm

The block should have an instance variable ... let's call it NumOfCol

On Collision with block | Add 1 to NumOfCol

If NumofCol = 2 | block : destroy

Every 4 seconds | Set NumofCol to 0

Cheers
B
35
S
16
G
16
Posts: 2,222
Reputation: 16,589

Post » Wed Feb 20, 2013 9:11 pm

Thanks you, both of you helped me figured out the solution :) have a nice day.
B
14
S
5
G
4
Posts: 15
Reputation: 3,794


Return to How do I....?

Who is online

Users browsing this forum: Unconnected, Yahoo [Bot] and 29 guests