8 Direction animation headache

0 favourites
  • 7 posts
From the Asset Store
4 Block Soldiers with different animations, 400x400
  • Hello forum, I was wondering if someone could check my pseudo?

    I'm working the animation system for a top down shooter, the character is currently split into 3 layers (Lower body, upper body and head) all stacked on top of each other; the following is my attempt to work out how the lower body (The feet) will work:

    It's currently contains two animations; Walk Forward, which shows the feet moving back and forth, and Walk Sideways which shows the feet strafing. It's my intention to have the Walk Forward animation play when the player is moving forward or backwards, and Walk Sideways when moving sideways.

    I naively thought that simple assigning the animations to key presses would work, but my sprites draw their angle from the mouse, and therefore it is possible for the player to push the "W" key (Which moves forwards from the default angle) and move sideways in relation to the mouse angle, this obviously creates problems.

    Below is a quick diagram I threw together to work out the animations:

    <img src="http://s16.postimage.org/qe80o2rx1/DRAFT.png" border="0" />

    My plan is to create 8 events, WF1-4 and WS1-4: The diagram above demonstrates the conditions for each event, for example:

    If the angle is between A8(315) and A1(45)and W is pressed, Walk Forward will play; if not (Else) Walk Sideways will play. The condition being the angle.

    After writing all of this my head hurts... I have a good feeling I'm severely over-complicating things; please help!

  • Whenever I make topdown animations, I never think in terms of forwards or sideways. It's always in terms of north, south, east, or west. As a heads up, an angle of 0 in Construct is always facing east, and if I remember correctly it likes to read the angles back as this:

          -90

    180        0

           90

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • so basically you try to make a movement like "Alien Shooter"?

    did you tried ataching the torso to the legs and making the torso act like a turret?

  • Thank you for the replies :D

    Similar to Alien Shooter; except when I say top-down shooter, I mean it literally, a birds eye view.

    Both the lower and upper body are directly synced to the mouse angle, it makes little difference: Though in mis-reading what you what you said (I originally interpreted it as detaching the feet from the mouse angle)I've thought of a quick fix; if the feet were made more simplistically in a general circle shape (Currently they're oval) they would appear the same from every angle, and as such the animation would display the correct leg work for the angle, however it would look cheap.

    What I'd really like is some CC on my proposed fix, and some help on the event construction :)

  • A quick update on this, I decided to ditch my frankly over complicated animation system in favour for a much simpler one, diagram below:

    <img src="http://i.imgur.com/qKBh4.png" border="0" />

    The condition is now dependant on the compass sprite (Synced with player movement/orientation) overlapping with one of four direction sprites that surround the game area.

    It effectively works, though there's some faults as I don't quite understand how the animation commands work

    Anyone have any ideas on how to improve animation logic? Currently it works great if you release the direction key every now and then and try and stay off of multi-key presses, but how would I go about improving the system to account for these?

    Obvious flaws that would be a quick fix is both animations playing on start-up and the length of compass not being perfect :)

    Here's the .capx:

    dl.dropbox.com/u/79581486/move.capx

  • How about this?

    8dirFeetAnimation.capx

  • ramones: You absolute gent! Thank you very much :D

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