[SOLVED] Strange collision behavior in Fruit Ninja-like

Get help using Construct 2

Post » Sun Jul 26, 2015 11:49 pm

Hi guys! ^^

I'm doing a action touch game like Fruit Ninja and I'm having a problem with an event that add "1" to a variable when a enemy is killed by the players's slice.

When I try to quickly cut the enemy, the collision sometimes added 2 or 3 for that variable. Why this happens if the enemy is immediately destroyed when it collides with the dash? :(
Last edited by lukezero on Tue Jul 28, 2015 12:07 pm, edited 1 time in total.
B
38
S
9
G
3
Posts: 258
Reputation: 4,324

Post » Mon Jul 27, 2015 6:37 am

What do the event conditions look like? If it's an On Collision event then it should only count once, but if it's something like Overlapping then it could count multiple times per iteration.
B
51
S
24
G
17
Posts: 293
Reputation: 12,561

Post » Mon Jul 27, 2015 12:08 pm

Right @Sup with that?, it was exactly what is happening on this case.

To solve this I just created new sub-variables to each monster and changed the "Add" condition to "Set". At last, I created a simple equation that adds these monster sub-variables.

Finally, the rule is never put "Add" in collisions, but always "Set". ;)

Image
Last edited by lukezero on Mon Jul 27, 2015 12:16 pm, edited 1 time in total.
B
38
S
9
G
3
Posts: 258
Reputation: 4,324

Post » Mon Jul 27, 2015 12:16 pm

You could have also used the "on destroyed" event to add to the score..
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 Jul 27, 2015 12:34 pm

"On destroyed" didn't worked here, @LittleStain. :(

This condition created more than one points for the count variable on the beginning of the stage, generating the "game over" event.
B
38
S
9
G
3
Posts: 258
Reputation: 4,324

Post » Mon Jul 27, 2015 12:44 pm

Should work, if set up correctly, but if you got it to work your way, it's ok, right?

"On collision" should only fire once as well (That is if there is only 1 object, which might be the actual problem)
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 Jul 27, 2015 12:50 pm

It can be a problem of indentation or switching, but I tried in various ways here and unfortunately don't worked. Your solution is even more practical, precisely because it's simpler.
B
38
S
9
G
3
Posts: 258
Reputation: 4,324

Post » Mon Jul 27, 2015 2:52 pm

Now I discovered the problem with the "On destroyed" here and he worked well, @LittleStain. :D

Thanks, man.
B
38
S
9
G
3
Posts: 258
Reputation: 4,324


Return to How do I....?

Who is online

Users browsing this forum: Lancifer, MPPlantOfficial, Sup with that?, ultrafop, Yahoo [Bot] and 64 guests