I currently have a big question for writing code for button commands and direction arrays. I write code for a horizontal button array that is in the form of something like this:
for (var i = 0; i < array_length_1d(left); i ++;){
if (keyboard_check(left[i])){
x -= spd;
break;
}
}
Then I create vertical button arrays where thew upward button array is correct but the downward button array is incorrect while distributing this code:
for (var i = 0; i < array_length_1d(down); i ++;){
if (keyboard_check(down[i])){
y += spd;
break;
}
}
When I try and Run the game, it shows this error:
FATAL ERROR in
action number 1
of Step Event0
for object obj_player:
Variable obj_player.down(100008, -2147483648) not set before reading it.
at gml_Object_obj_player_Step_0 (line 25) - for (var i = 0; i < array_length_1d(down); i ++;){
What am I doing wrong?