How do I PLAY only once per action/animation?

0 favourites
From the Asset Store
Change the size and position of everything without calculating anything!
  • Hello Everybody,

    I'm new to C2, I just started to mess around to learn it, so far I mad what I like but I ran into a problem that I don't know how to solve.

    I've created an event when a button pressed it changes to JUMP animation and play a sound, same goes for the SHOOT animation. (different button of course).

    The problem is:

    When I press UP the character will jump once and land which is great, but while in the air... if I click many times the sound will play many times.

    I want it to play only ONCE when I jump, or when I shoot so even if I'll press UP many times in a raw it will play the "jumping sound" only once.

    Sorry about my bad English and thanks ahead for the help!

  • Make a condition:

    Sprite not is playing "JUMP": play sound

    Then make the character jump.

  • Thanks for the fast reply,

    Maybe I did this all wrong:

    Hero >> Is animation "Jump" playing >> Play Audio "Jumping sound"

    Now no sound while jumping, I did try to look for what you typed but I'm a bit lost, because I'm still new to C2 after all.

    Any chance for a screenshot or example file please?

  • Hero >> Is animation "Jump" playing >> Play Audio "Jumping sound" - this will play audio file constantly. If you want to do it that way it should look:

    Hero| Is animation "jump" playing

    > Trigger once -> Play Audio file - this is sub-event

  • Hero >> Is animation "Jump" playing >> Play Audio "Jumping sound" - this will play audio file constantly. If you want to do it that way it should look:

    Hero| Is animation "jump" playing

    > Trigger once -> Play Audio file - this is sub-event

    Thanks shinkan,

    I tried to do what you explained, I may be wrong... where did I go wrong?

  • Like this

    but your event should work too.

    If it's not working issue is somewhere else.

  • I have no sound when jumping now.

    maybe you can see what I did wrong in the screenshot?

    *The marked event is not make any difference, with or without it... still no sound.

  • Set animation "Jumping" playing

    is animation "Jump" playing.

    Jump is not the same as jumping

  • lennaert what he said. You are setting one animation to play, but check if different one is playing.

  • Thank you guys for your patience with my confusion...

    I'm trying to be organized and still messed up... hope I'll get better in this, it's my very first try in C2.

    OK, so I fixed the "jumping" which is a tag for the sound to the "Jump" which is the name of the animation.

    Now the very first Jump (Up pressed) is working, and that's it... no more jump sounds, I think it's something to do with the trigger once... I'm trying to play with it's order or something.

  • If you shoot, and then jump again, do you get sound then ?

    (Im thinking the animation needs to change before its triggered again on jumping)

  • Yes, it's like resetting the event when I press the "C" button.

    The good thing is that when I press "UP" it only works once as it should, but.. won't play anymore unless I click "C" again.

    I flipped the order, so the trigger once is now before (above) the "Jump" animation, but now there is no sound at all, so I Undo that.

  • It does not need a fix, it requires "more"

    If you have an idle animation:

    event:

    on anmation jumping finished

    action:

    play idle animation

    when the animation changes, the trigger once condition gets reset.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've added it, but still no sound after the first "UP".

    Wow.. I guess it's not as simple as I thought it will be hehe.

  • Did you change the order back ?

    Meaning, trigger once below the jumping.

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