How to: Sidecroller Attack Animation

For questions about using Classic.

Post » Sun Apr 19, 2009 8:41 pm

First let me say how much I hate pretty much hate registering on a forum and asking for help as one of my first posts, anyway, here's my problem.

I'm making a platformer and have been following Deadeye's fantastic tutorial, now I'm trying to make my character (Gambit) attack.
I've got 6 frames of animation for him to attack but I just can't figure out how to do it. I simply want for the animation to play once the "Shoot" button is pressed, and then return to usual standing animation.

All I've managed to do myself has always crippled the standing animation, I need some kind of..."unless" command for the "Walking animation else stand animation". Honestly it hurts my head at times trying to think of all the logic gates.

Here's a link to my .cap
[url:fl7uzpm3]http://www.box.net/shared/6bgvq6b2qj[/url:fl7uzpm3]
B
2
G
3
Posts: 40
Reputation: 930

Post » Sun Apr 19, 2009 9:00 pm

there's an "On animation finished" event

look under the animation tab in the events for your sprite. You could unset whatever flags there and set the animation to the idle one.
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Sun Apr 19, 2009 9:46 pm

[quote="Madster":3himd247]there's an "On animation finished" event

look under the animation tab in the events for your sprite. You could unset whatever flags there and set the animation to the idle one.[/quote:3himd247]

I don't know if you know this method works, but I had no luck with it.
Still either playing the first frame of the attack animation for a split second and returning to standing, or playing the attack animation and not returning to standing at all.

B
2
G
3
Posts: 40
Reputation: 930

Post » Sun Apr 19, 2009 10:08 pm

http://dl.getdropbox.com/u/529356/Gambit.cap

I've bookmarked the changes.

When you set the animation for attacking, it's only set one time. When the event sheet loops to the top again on the next tick, you're setting the animation right back to "Standing" or "Walking" or whatever, so you don't see the full animation. You have to be careful with the order of your events, and you have to make sure you're not cancelling out your events with other events.

I added a "NOT Animation 'Attack' is playing" condition, and put your standing, walking, etc. events under it as a sub-event.

The "Set frame to 1" is to insure that your attack always starts on the proper frame. If you're walking, and you press Attack on frame 4 of the walk cycle, then you will be in frame 4 of the Attack cycle when you switch over. Setting to 1 fixes that.

Also, there is no need to use "On animation finished." Since the animation is not set to Loop, it finishes on it's own... so the "NOT Animation 'Attack' is playing" condition is met as soon as it's done.

Hope this helps.

Edit:
You also had a blank frame on angle 180 of your falling animation, so Gambit was disappearing when he fell. I took it out for you ;)
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sun Apr 19, 2009 10:17 pm

deadeye! I was hoping you'd see this.

Thanks very much for the changes, thanks even more so for explaining it so I could understand, it makes so much sense now, but isn't that always the way.

Again, thanks. :mrgreen:
B
2
G
3
Posts: 40
Reputation: 930

Post » Sun Apr 19, 2009 10:20 pm

It's great when you're writing an answer just to notice deadeye was faster. lol :)

Still I have a little thing to add:

I noticed that you might have tried to use tagged animations on the character. This only works with the object that has platform behavior applied to it. You could still use tagged animations and set the animations of your visible sprite accordingly with an always event. But beware tagged animations are currently a little buggy or so I've heard. :wink:
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Sun Apr 19, 2009 10:26 pm

[quote="PixelRebirth":2wvp1dgg]It's great when you're writing an answer just to notice deadeye was faster. lol :)

Still I have a little thing to add:

I noticed that you might have tried to use tagged animations on the character. This only works with the object that has platform behavior applied to it. You could still use tagged animations and set the animations of your visible sprite accordingly with an always event. But beware tagged animations are currently a little buggy or so I've heard. :wink:[/quote:2wvp1dgg]

Ah I see thanks for the heads up, so I'd use them if/when I want varying sized hitboxes
B
2
G
3
Posts: 40
Reputation: 930

Post » Sun Apr 19, 2009 10:31 pm

Hitbox editing is planned for the future, so you won't have to use a separate hitbox for your platform sprite. You'll be able to use tagged animations okay then.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Mon Jun 07, 2010 12:34 am

deadeye and lemming, do you still have this .cap available? I'm in the same predicament at the moment, and would greatly appreciate it!

thx

~t
B
4
S
1
G
2
Posts: 61
Reputation: 997

Post » Mon Jun 07, 2010 11:46 pm

Anyone... Bueller?
B
4
S
1
G
2
Posts: 61
Reputation: 997

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests