• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Sprites and variables

D

deem93

Guest
Hello!
I have a variable that controls my characters sprites and I'm using macros to determine which sprites are being used.
For example
Code:
variable [playerDirection, playerAction] = sprABCD
I would like to add additional conditions to that formula, example
Code:
variable [playerArmor, playerDirection, playerAction] = sprABCD
For some reason it does not work, i get an error message saying "got ',' expected ',' or ']'" and "unnecessary expression ... used as a statement".
Any idea why does it happen and what should I do next? Thanks in advance!
 
T

TimothyAllen

Guest
GMS2 doesn't have 3D arrays. If you want this functionality, you will have to use nested arrays. I don't think that's the correct term, but I just woke up. For 3D array you can use:
1. Array of arrays of arrays of sprites.
2. Array of 2D arrays of sprites.
3. 2D array of arrays of sprites.

EDIT: I should also mention that you could use a single array and access it as a 3D array.
x + (y + z * depth) * width

There are also other things you could do... such as a ds_map of arrays. If you have lots of options.
 
Last edited by a moderator:
Top