[Isometric] 8 Animations for 8 directions

0 favourites
  • 4 posts
From the Asset Store
Character Sprite Pack: Walk 4 Directions made in illustrator
  • Hello guys,

    I'm part of a team of students who would like to do a tower defense game as their project and we would really much appreciate any advice regarding our problem.

    Now, I've noticed that in isometric tower defense games, the little soldiers usually have 8 different animations for 8 different directions. So, when the soldier is walking from south to north, there's an walking-animation that shows him from behind; another one that shows him from the front when he's going from north to south and so on.

    In the attached example project I have set up 8 animations:

    [attachment=2:t6tdp5st][/attachment:t6tdp5st]

    Since I can not call every single animation directly with one single event (because the "Set animation to..."-event needs a string as input which I can not directly get from the "Enemy.Pathfinding.MovingAngle"-call (gives only numbers)) I have used an array to assign each animation an int-variable.

    [attachment=1:t6tdp5st][/attachment:t6tdp5st]

    And then there's that crazy mad action (with the red arrow next to it) that sets the correct animation depending on the moving angle. I partly stole that action from another thread and it works now, but our game is already really heavy and with 30 units each calling that action every tick I'm afraid that the game will go into cardiac arrest. So my question is:

    Is there a better way? One that is perhaps less hard on the processing power?

    Thank you very much for any advice. This forum has already helped me a lot.

  • You could just do it like this, without the every tick:

    (For multiple enemies just add a system for each enemy condition)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I downloaded your file and took a look. It looks pretty good to me but, when you get a bunch of animations your array will grow exponentially. What I usually do is, rather than naming my animations with a direction, I name them according to the action the animation represents and append a number that represents the direction (e.g. walk1, walk 2...). Then, since you are already calculating the direction number, append it to the end of the animation name. Attached is a modified version of your file with the suggested change. Take a look at how I renamed your animations and the every tick event.

  • Just dropping by to say thank you, both of your suggestions worked.

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