How do I PLAY only once per action/animation?

0 favourites
From the Asset Store
Per Pixel Destruction like in "Worms" (perfect performance, no third party plugins)
  • Yes I did, but it didn't work.

    SOLVED? (I'm not sure if it's a stable solution)

    I just added another event:

    Hero > Platform is on floor >> Set animation to "Idle"

    And it works... I mean, it make sense in a way but I didn't imagine it will be so complicated just to deal with the audio, I didn't even start with the real complicated stuff.

    I'm not sure if that's the best solution, I will have to test it in more situations but for now it's not repeating unless I'm jumping lots of times into a really low platform so it repeats and get higher volume...

    Now I'll need to see how I solve the same problem... with different thing like "Shot" animation, because what if he is ALREADY touching the floor... it won't work, only if he shots while jumping.... that's why I think this "SOLUTION" is not good.

    Anyways, Thank you so much for taking the time and helping me in this, it's the best way to learn different solutions, you are very kind and I appreciate it.

    Anybody who have example files with less events to keep it simple, I'll be happy to download and explore it to see how you solve this issue.

  • Hey

    I think there's an easier way. Use your "On Up arrow pressed" event.

    In this event make a subevent "Is animation "Jump" playing" and invert it.

    In this subevent Play your sound.

    UNDER the subevent set the Animation to "Jump"

  • Thanks Rabenmutter,

    I just tried your way and the result is just like the very first problem:

    If I press "UP" many times (while the player is on the air) I can flood it with so many jump sounds.

    Any more ideas, or example files will be welcome.

  • Did you invert the event?

  • Yes, I followed your instructions.

    Maybe a good solution could be with variables like some kind of more manual trigger/toggle option of the sound but I'm very new to C2 I still need to learn how to create variables hehe...

  • This just worked perfectly fine for me

  • I tried to clean almost everything else like the other buttons to make sure that I will find what is wrong with my code... because I have no clue why there is no sound at all when I use your way, maybe I did something wrong and I missed it?

    Please let me know what is wrong here, so I can fix it:

  • Hehe, yes Remove the first "Set animation to Jump" in the up arrow event.

    And the other "Set animation to jump" is a sub event in your code (But i think this doesnt make any difference)

  • Well, if I remove it we're back to the part where it plays once... and no more lol

    Wow... I never thought that my first experience with C2 will be so confusing.

    I can't give up yet... still trying to mess with it, there must be a solution!

    Maybe there is a "secret" plugin or behavior I need to download?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Show me what you've got now (also the on land platform). Cause it worked without any problems in my project.

    Or hand me your capx and I'll fix it for you.

    Edit: hey Buddy, I have to go now. Actually it's really not hard to do this. We're gonna fix this tomorrow

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