Strange issue with "Wait" when the Player object falls off screen

0 favourites
  • 4 posts
From the Asset Store
Add calm and a lounge vibe to your games with these 8 tracks
  • I have a PlayerDeath function that I call when my Player object hits a spike or falls off the screen (out of layer bounds).

    Inside the PlayerDeath function is a Wait command in order to display the Death animation, screen shake, and sound effect before restarting the layout.

    This works perfectly when hitting a spike.

    But when the player falls off-screen, the PlayerDeath function plays the sound effect repeatedly at the same time (so it sounds much louder). This behavior doesn't happen with the spike, even though the Spike collision and the falling off-screen both call the exact same PlayerDeath function. I'm not sure what the difference is and why the spike collision works perfectly but falling off the screen does not.

    I've included a picture of the PlayerDeath function (I'm very new so apologies if the code is amateur).

    The way I'm calling the function is either:

    Player -> Spike collision: Call PlayerDeath

    or

    Player -> Is outside layout: Call PlayerDeath

    Why does one work perfectly and the other causes the sound to mess up?

  • 'On collision' with spike is a trigger event and runs the function once. 'Is outside layout' runs every tick so repeats the function up to 60 times a second. You can fix it by adding trigger once condition to 'is outside layout'.

  • 'On collision' with spike is a trigger event and runs the function once. 'Is outside layout' runs every tick so repeats the function up to 60 times a second. You can fix it by adding trigger once condition to 'is outside layout'.

    Thank you! Is there a way to turn the “out side layout” check into a trigger event? Or another way to accomplish the same thing?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ah I just reread it... I’ll look into the “trigger once” thing! Thanks again

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