Make a sound play only once on VARIABLE = 0

0 favourites
  • 7 posts
From the Asset Store
Change the size and position of everything without calculating anything!
  • Hi!

    I'm trying to make a sound play only once when a variable arrives at zero.

    I'm making a zombie killing game and when the zombie count arrives at zero I play a sound and show a screen that says winner, etc.

    But the problem is that the sounds get played back-to-back on every tick and it's making an insane effect hehe. Here's what I've done:

    <img src="http://i.imgur.com/PVeq8.png" border="0" />

    Thanks!

  • Add the "Trigger once" condition

  • Oh I wasn't aware of this condition! Thank you!

  • Oh but, in this "Trigger Once" there's no condition to put? How do I trigger it once if let's say : NB_ENEMIES arrives at zero? Thanks!

  • Try Construct 3

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

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

    AS you can see, I used the expression "Count" that counts the number of instances of an object on screen.

    In events, you can associate several conditions (right click, add another condition)

    Also the order in which the conditions are placed matters. At first, I had "Trigger once while true" as the first condition, and it did not work. Placing it as a second event works as intended.

    This example might not apply totally to what you're doing. But I guess it is a good base, and with a few tweaking/adaptation it will fit right in.

    And nothing prevents you from comparing a variable rather than an expression.

  • You just add 'trigger once' at the bottom of the event you want to trigger once.

  • Thanks to both of you!

    Both of your answers served me very well!

    I'm starting to get all the posibilites C2 has to offer. Seriously, I'm starting to have a very good game hehe.

    I'll put it up on the arcade as soon as I have a complete level!

    This is AWESOME! :-)

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