help with animations and propper event order

This forum is currently in read-only mode.
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • Hi there, I�m 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!

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

    + 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:
    
    <img src="http://i43.tinypic.com/1zfk03r.png">
    
    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.
  • 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.

    I�ll try to fix it, but probably I�ll 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!

  • Try Construct 3

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

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

  • It also worked as you suggested. Thanks again, see you soon.

  • 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

  • Thank you for being so clear in these situations, because I've been having trouble with my game and is now resolved.

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