How do I PLAY only once per action/animation?

Get help using Construct 2

Post » Fri Feb 28, 2014 2:31 pm

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)
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,592

Post » Fri Feb 28, 2014 2:39 pm

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.
B
10
S
1
G
1
Posts: 40
Reputation: 764

Post » Fri Feb 28, 2014 3:58 pm

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.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,592

Post » Fri Feb 28, 2014 4:09 pm

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.
B
10
S
1
G
1
Posts: 40
Reputation: 764

Post » Fri Feb 28, 2014 4:30 pm

Did you change the order back ?

Meaning, trigger once below the jumping.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,592

Post » Fri Feb 28, 2014 4:39 pm

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.
B
10
S
1
G
1
Posts: 40
Reputation: 764

Post » Fri Feb 28, 2014 5:39 pm

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"
B
14
S
3
G
1
Posts: 255
Reputation: 2,027

Post » Fri Feb 28, 2014 5:53 pm

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. :)
B
10
S
1
G
1
Posts: 40
Reputation: 764

Post » Fri Feb 28, 2014 6:07 pm

Did you invert the event?
B
14
S
3
G
1
Posts: 255
Reputation: 2,027

Post » Fri Feb 28, 2014 6:12 pm

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...
B
10
S
1
G
1
Posts: 40
Reputation: 764

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider] and 5 guests