Can you force an animation to finnish?

Get help using Construct 2

Post » Mon Sep 23, 2013 8:41 am

Short version

I need to know if there is an action or condition in construct that will essentially make an animation play out entirely no matter what.

Long Version

so in my game i'm trying to have a block and dodge system where holding the Z key will put you in a block stance, and pressing left or right on the keyboard will make you dodge left and right respectively. So far so good. but the problem comes in with the dodge animation. Right now, the condition I have is this

Condition: Z key is down
Sub-event: Right/Left key is pressed
Action: Set animation to Dodge

So I set this up and because I want the dodge to shoot you left and right rather quickly, I've given the player character bullet movement that is enabled when the dodge animation is playing and gets turned off when it's not.

But here's the problem

Because of my conditions, if i'm not holding the Z key and the right/left key, then the dodge animation just stops halfway through and the bullet movement is still there, so my character just glides across the floor till they hit the wall. If i hold both the Z key and the left or right key until the animation is over, then everything works fine, but if I don't, then i've got problems.

So I essentially need a way to make sure that the entire animation plays regardless of whether I'm holding the z and left/right key throughout the entire animation. I've been trying to come up with some roundabout ways to make this happen, but I just need to know if there is a convenient action that could just force an animation to play out entirely. I'll post the capx. below.

https://www.dropbox.com/s/ucsjspus1z668sl/BlockDodgeProblems.capx
CDAfree2013-09-23 23:43:42
B
6
Posts: 25
Reputation: 300

Post » Mon Sep 23, 2013 10:00 am

The other animation that plays (which I assume is an idle animation?), set it up so that the animation is only triggered if Dodge is not playing.
B
46
S
16
G
79
Posts: 2,170
Reputation: 46,857

Post » Mon Sep 23, 2013 5:35 pm

Well.. you kinda did'nt post the capx down below ^^

Also... you can make an instance variable that activates when the player is doing the required stuff for the animation to play, wait the amount of time that is needed for the animation, set the value of the instance variable to something else and it should end up fine :) Post the capx and I'll show you, or PM it to me. Or something... this is very hard since I don't have the capx but I can probably solve your problem maaaaate
B
12
S
2
G
4
Posts: 78
Reputation: 3,332

Post » Mon Sep 23, 2013 5:43 pm

Would setting the animation to loop only once, and then having "on animation finished" check to see if it should be replayed again or not work?
In other words, when the animation finishes it restarts if the key is down, otherwise it ends after that loop.
B
233
S
62
G
33
Posts: 902
Reputation: 40,398

Post » Mon Sep 23, 2013 5:55 pm

That can work - you can also add a condition so that your player's action only goes through if you're not in block state. You would do that by checking for which animation is playing, then inverting that condition.
B
17
S
4
G
4
Posts: 143
Reputation: 4,004

Post » Mon Sep 23, 2013 6:08 pm

Yes you can, but you have to Greece it up a bit, and it helps if you are Hungary.

Otherwise Netherlands will help you, but if you ask a different way Samoa may help you.

Uganda do that, or eat some Turkey?
Image ImageImage
B
169
S
50
G
174
Posts: 8,328
Reputation: 110,800

Post » Mon Sep 23, 2013 7:12 pm

Very helpful! Thanks, I'll keep that in mind.
B
12
S
2
G
4
Posts: 78
Reputation: 3,332

Post » Mon Sep 23, 2013 11:12 pm

Gah, forgot to put the link in, here it is

https://www.dropbox.com/s/ucsjspus1z668sl/BlockDodgeProblems.capx
B
6
Posts: 25
Reputation: 300

Post » Tue Sep 24, 2013 5:28 am

@plinkie

[QUOTE=plinkie] The other animation that plays (which I assume is an idle animation?), set it up so that the animation is only triggered if Dodge is not playing.[/QUOTE]

So I added this condition to my Idle animation trigger

Is animation "Dodge" is playing (inverted)

But i still have the same problem, if I stop holding the left or right key, the animation just stops midway and the bullet behavior persists. I've tried a couple of things myself but now i've just reversed my problem. Now if I let go of the left or right key the animation still plays (yay!), but now if I let go of the z key mid animation, they animation will just stop and I go back to having the same problem I had before (boo!)
B
6
Posts: 25
Reputation: 300

Post » Tue Sep 24, 2013 11:45 am

Add an inverted 'Dodge' is playing to event 35
B
46
S
16
G
79
Posts: 2,170
Reputation: 46,857

Next

Return to How do I....?

Who is online

Users browsing this forum: Ashley, dop2000, jatoblendy, MathNook, Yahoo [Bot] and 29 guests