[SOLVED] Strange collision behavior in Fruit Ninja-like

0 favourites
  • 8 posts
From the Asset Store
Fruit Slicer Template & Quality fruit and slice graphics (capx,c3p,png,illustrator files)
  • 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?

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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".

  • You could have also used the "on destroyed" event to add to the score..

  • "On destroyed" didn't worked here,

    This condition created more than one points for the count variable on the beginning of the stage, generating the "game over" event.

  • 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)

  • 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.

  • Now I discovered the problem with the "On destroyed" here and he worked well,

    Thanks, man.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)