How do I make my animation stop after press button once

Get help using Construct 2

Post » Sat Jan 07, 2017 7:48 am

I make a variable to my playermask "normalattack" to false

And then when A key is down set playermask "normalattack" to true

When "normalattack" is true > play realplayersprite animation to Punch which is only have 1 frame

The problem is as long as the A key is down it freeze the animation and when i release the key it goes back to idle

How can i make the animation just play once after the A key is press and not freeze the animation if i hold the key down? Like street fighter game kinda thing. Can someone help ?
B
7
S
1
Posts: 10
Reputation: 406

Post » Sat Jan 07, 2017 11:30 am

Try setting your animation to play from beginning and not to play frame 0.

If that isn't what the issue is, please attach a CAPX and I'll look it over
Using R243 for all examples
B
69
S
20
G
6
Posts: 379
Reputation: 9,699

Post » Sat Jan 07, 2017 12:04 pm

An animation with 1 frame will trigger the 'stopped playing' in the same tick.
Give it at least 1 frame more (i prefer 2).



Now you have two options.
1/ Set 'normalattack' to true on pressing 'A'. With an aditional 'trigger once while true'
2/ When "normalattack" is true > play Punch .. from beginning (animation must not be looping) ...
3/ Set 'normalattack' to false on Animation 'Punch' finished.
4/ All other animation events get an additional 'when "normalattack" is false.

Or, not using a boolean.
1/ Set Punch to play when pressing 'A'. With an aditional 'trigger once while true'
2/ All other events that start an animation get an additional condition 'when Punch is not playing' (inverted is playing).
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sat Jan 07, 2017 4:24 pm

this is my capx

www(dot)dropbox(dot)com/home?preview=worrior+testing.capx


this is the image of my event sheet unless you cannot open my capx

www(dot)dropbox(dot)com/home?preview=testingworrior.jpg
B
7
S
1
Posts: 10
Reputation: 406

Post » Sat Jan 07, 2017 4:36 pm

Sure, give me login for your dropbox (you better not !)

Or, share :
https://www.google.be/search?q=dropbox+ ... hared+link
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sat Jan 07, 2017 5:38 pm

This the capx file

www(dot)dropbox(dot)com/s/sxnzpfy6ybzqelg/testingworrior.jpg?dl=0

This the img

www(dot)dropbox(dot)com/s/9nqwggings058kx/worrior%20testing.capx?dl=0

Sorry for the wrong link just now
B
7
S
1
Posts: 10
Reputation: 406

Post » Sat Jan 07, 2017 8:21 pm

Fixed ?

https://www.dropbox.com/s/h4asvgiry5zt3 ... .capx?dl=0

Although there is no 'punch' animation in it.

Besides that.
My heart cringes when i see how so many people mess up the animations by cropping the transparent edges in each frame.
As a result each frame has a different size. And the relative position of the pixels of the graphic content towards the origin is dancing in each frame.
As a result, a helper object, just to move the animated sprite, is mandatory, even in a simple project.

I tried to fix the animation a little bit.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sun Jan 08, 2017 11:11 am

about cropping the transparent edges i just follow from tutuorial lot of em doing that , im still in learning how frame size and the origin point of each frame effect the animation, like on my attack animation u put the origin point on the worrior back leg on each frame it looks perfect now but on tutorial that i've learn they used to put the origin point in between the leg, tqsm it fix i cant believe it just that simple actually.
B
7
S
1
Posts: 10
Reputation: 406


Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], brunopalermo, plinkie, rayolf and 13 guests