How to: Sidecroller Attack Animation

This forum is currently in read-only mode.
From the Asset Store
Zombie attack is a survival game, where you have 2 types of games: Killer and survival.
  • 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

    http://www.box.net/shared/6bgvq6b2qj

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

    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.

    <img src="http://img26.imageshack.us/img26/4471/gambitstandw.jpg">

  • 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

  • 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.

  • 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.

  • 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.

    Ah I see thanks for the heads up, so I'd use them if/when I want varying sized hitboxes

  • 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.

  • 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

  • Anyone... Bueller?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)