Choose adjacent strings in Array

Get help using Construct 2

Post » Fri Feb 22, 2013 7:16 pm

I'm working on a game with an elaborate animation system.
The character is asymmetrical so I have to use separate animations for left or right rather than using mirroring, and I also have it set up so that when you press a particular attack key, the resulting attack animation is different depending on your current animation.

To easily manage this I figured I could use a 3D Array. X lists each possible animation, Y lists the normal or attacking variant parallel to each other, and the Z determines whether it is the left or right version of the animation.
I've never actually used an array before though, and the process is very complex.
I've already stored all the animations in the array, but I need to know how I can set it up so that an event will read the X of an array when the key is pressed, and once it finds the one that's currently playing it'll activate the animation directly beneath it on the Y axis.
It would also decide which Z axis to search through based on the direction the player is facing (which I've stored as a variable).

Say the player is facing right and playing the animation stored on (X2,Y0,Z1), it would search through Z1 until it finds X2, then play the animation stored on (X2,Y1,Z1).grimwolf2013-02-22 19:17:59
B
6
S
1
Posts: 67
Reputation: 986

Post » Tue Feb 26, 2013 7:00 am

This will help you to understand the basics of arrays:

https://www.scirra.com/tutorials/307/arrays-for-beginners/page-1

From my experience I'd recommend trying to keep it XY only if you can, it keeps things simpler. Also it helps to plan out your array on paper or in a spreadsheet.
B
7
Posts: 38
Reputation: 476


Return to How do I....?

Who is online

Users browsing this forum: Colorfish, Waltuo and 4 guests