[Isometric] 8 Animations for 8 directions

Get help using Construct 2

Post » Fri Jul 18, 2014 8:09 pm

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:

scrnsht_animations.jpg


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.

scrnsht_events.jpg


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 do not have the required permissions to view the files attached to this post.
B
13
S
2
Posts: 21
Reputation: 721

Post » Fri Jul 18, 2014 9:04 pm

You could just do it like this, without the every tick:
(For multiple enemies just add a system for each enemy condition)
You do not have the required permissions to view the files attached to this post.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Jul 18, 2014 9:46 pm

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.
You do not have the required permissions to view the files attached to this post.
B
40
S
12
G
11
Posts: 331
Reputation: 7,752

Post » Fri Jul 25, 2014 4:47 am

Just dropping by to say thank you, both of your suggestions worked.
B
13
S
2
Posts: 21
Reputation: 721


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 21 guests