[Solved] How do I Stop audio repeating on collisions

0 favourites
  • 7 posts
From the Asset Store
100+ Musical High Quality Sound Effects for your game!
  • Hi

    I have the 'player' and some 'baddies'. The baddies have the sine behavior so they move left and right along a floating platform, and the solid behavior.

    The player has the platform and boundToLayout behaviors.

    When the player collides with a baddie, I play a sound. Now the baddie will push the player which is what I want, but as it's pushing it the collision sound will repeat.

    What I'd like is for the collision sound to only play once, or for it to play say every 0.5 seconds (for example).

    I've tried with a system-wait for 1 second, but that doesn't work.

    I'm sure I'm making a fundamental error, so any help would be appreciated.

    The .capx should be below, it's made with construct R182.

    Thanks

    Nick .

  • You can more effectively control what happens in your game by using variables. In your case, a variable that checks if the player has been hit or not can solve your problem. I've updated your capx, check it out.

    Also, as a side note, try to use the Tilled Background object for repeated textures, I've also changed the platforms and the ground in your capx.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Try this

  • eli0s

    that's a great solution, thanks for putting the effort in explaining it all.

    Adding the extra flash and 'bounce' features look fab too, thank you.

    Also, I've never really understood Tiled Backgrounds, so thanks for replacing my platforms with them, that has helped me get my head around them!

    Nick .

  • Lordshiva1948

    Ah, that is working better than my method too, thank you for the help.

    Nick .

  • Nick Most welcome dear friend. Any time you need help plz pm if you wish

  • nickl ,

    You are welcome, I am glad I helped!

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