Okay I need some handholding... what exactly is being done here?
Aqua wanted to use a numeric value to get some other value, so the simple solution is an array. The odd numbers aren't used, so those values don't matter - we leave them as zero. (note that there was a mistake in my first post, there needs to be one more empty element at the beginning of the array for index 0).
So the array is
[0, 0, 'down', 0, 'left', 0, 'right', 0, 'up'] - we don't care about actually declaring a variable that's going to store these values, we're just going to reference it on the spot. Just like you could type the number 5 or the string "stuff".The syntax to reference one element of an array is
array[index] - in this case, we're using the output of $gamePlayer.direction() as the index.Thus:
If you don't like the empty elements in the array, you could do some math to the output of the function:
Code:
['down', 'left', 'right', 'up'][$gamePlayer.direction()/2-1]