Choose adjacent strings in Array

0 favourites
  • 2 posts
From the Asset Store
This collection of music is the beautiful performance of rather small strings ensemble (8 first violins, 6 second violin
  • 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).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This will help you to understand the basics of arrays:

    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.

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