Trigger Turning Animation w/ 8 Way Movement

0 favourites
  • 2 posts
From the Asset Store
Run and Jump in 3 Dimensions! Take your platformer to the next level!
  • Hello fellow developers,

    Some of you may have seen me around the forums. I'm working on a Superhero game. I ran into a problem and could use some help.

    Currently, the player uses the Platform Behavior when he is on the ground. When he flies, it switches to 8 Way Behavior. The problem I'm having is that if I'm flying East and then immediately fly to the West, the art just mirrors. What I would like to do is add an animation of the character changing direction.

    First off, I don't know how to trigger that. Second, I need to do opposite angles (North to South, East to West, NorthWest to SouthEast, etc), so a simple "if player is mirrored and you press right arrow than play animation" might not work.

    Any suggestions on how to do this would be greatly appreciated.

    You can check out the current build of my game here to see the type of animation I'm going for: http://www.needyourdisease.com/p/superhero-game-current-build.html

    Thank you for your time.

    Ben

    Twitter:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I haven't worked with animations much yet, but what I would try if I were you would be comparing the current animation frame and what arrow key is being pressed in order to change the current animation.

    I'd set up two separate animations, the first having the frames for the character flying up,down,left right,hoverLeft,hoverRight. then make another animation with just the "turning" frames. From there, you could try something like this:

    Animation frame = 4                         set Animation to "turns"
    On Right Arrow pressed -------------------> set Animation frame to 1[/code:13it0r9h]
    *assuming frame 4 was the player flying or hovering facing left and that frame 1 of the "turns" animation was the left to right turn sprite.
     
    If something like this didn't work, I'd try setting up multiple 3 frame animations for each direction you need to turn and then when an arrow key is pressed in the opposite direction the player is currently facing, set the active animation to the particular "axis" you're turning on. On completion of the animation you could set the active animation back to the original and set the frame to whatever direction you were supposed to be flying in.
    
    Like I said, I haven't gotten too deep into animations yet, but this seems like it should work. I'm sure someone with MUCH more experience will come and help you out with this though.
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)