help with animations and propper event order

Post your own tutorials, guides and demos.

Post » Sat Jun 20, 2009 9:56 pm

Hi there, Im new to Construct and I love it.

I have found this little problem: this is a platform test with a soldier (public domain sprite) that shoots a gun. I have set up the animations for running, standing, and crouching, and it works ok. Then I also set up two more animations for the recoil when shooting, one while standing, and the other for crouching (two frames each).

The problem is that when I shoot, it only shows the first frame of the recoil animations, and it keeps on frame 0, as I see in the debugger. I want to see the two frames loop while the "shoot" key ("X") is down.

I tried different event orders, with and without sub-events, and I cannot manage it to work. I must be doing something wrong with the event setup.

Any clues to help me sort this out?

Thanks very much for your help, and if you developers read this, congrats for your efforts, this program is amazing, I always dreamed about making my own games! Keep the good work!
B
1
G
3
Posts: 5
Reputation: 835

Post » Sat Jun 20, 2009 10:19 pm

It's because you're setting the "Standing" animation in the event right above. Every tick, the condition happens:

[code:1mt93gid]
+ NOT Is walking
[/code:1mt93gid]

So the action triggers:

[code:1mt93gid]
+ Soldier: Set animation to "Standing"
[/code:1mt93gid]

Now, "Standing" has only one frame. Frame numbers carry over from one animation to another. So you set the Standing animation, and soldier goes to frame 1... then in the next event you set the Shooting animation, and it shows frame 1. It does this every tick, so you will never see frame 2 of your Shooting animation.

You need to add some conditions to your other events, like so:



This means that you will only set the Standing animation if the player is not shooting. So you change from Standing to Shooting just once, and the animation can then play through all the way because you don't keep setting it back to frame 1 every tick.

Hope that makes sense.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sat Jun 20, 2009 10:48 pm

Thanks a lot deadeye for your fast answer, your platform tutorial is awesome.

Yes, I did as you said, and that fixes the recoil animation problem, but now, if I keep pressing the "shoot" key and i move to left or right, the soldier "slides" over the ground, as the condition "is walking and X is not being pressed" doesnt occur and so the "running" animation is not started.

Ill try to fix it, but probably Ill have to post for help again. Back to it...

EDIT:

I DID IT!!. I just had to add another event below the last one, saying: if "player" is walking, then set the soldier animation to "running". As the application reads it after the other animation events, as soon as i move the soldier, the running animation starts, even if I keep pressing the "shoot" key. It may not be the most efficient way to do it, but it worked!
B
1
G
3
Posts: 5
Reputation: 835

Post » Sat Jun 20, 2009 10:53 pm

So take the "NOT X key is down" event out of #4 :)

Just keep in mind that some events can override other events, and be careful that you're not overriding things you don't want overridden.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sat Jun 20, 2009 11:11 pm

It also worked as you suggested. Thanks again, see you soon.
B
1
G
3
Posts: 5
Reputation: 835

Post » Fri Jul 31, 2009 7:54 am

How do I make those animation pictures? I don't want something I have to buy though. Is there like a website where I can Make my own pictures into animation? By that I mean like flashing from picture to picture.
___________
punjabi matrimonial
B
1
G
3
Posts: 1
Reputation: 827

Post » Thu Apr 05, 2012 4:41 am

Thank you for being so clear in these situations, because I've been having trouble with my game and is now resolved.
B
3
G
1
Posts: 9
Reputation: 518


Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 1 guest