DeadSigilGames
Member
Hello, i'm having a bit of trouble on making my array work with the switch function.
I have my direction variables stored in a array in the create event like this:
Now in the step event i want to read these statements and return wich one i'm in.
I've been trying to do it like this:
And so on...
But it's not returning anything, i don't know the best way to do this so any ideas and directions will help a lot!
Thx in advance!
I have my direction variables stored in a array in the create event like this:
GML:
dir = [
direction <= 11.25 || direction >= 348.76,
direction >= 11.26 && direction <= 33.75,
direction >= 33.76 && direction <= 56.25,
direction >= 56.26 && direction <= 78.75,
direction >= 78.76 && direction <= 101.25,
direction >= 101.26 && direction <= 123.75,
direction >= 123.76 && direction <= 146.25,
direction >= 146.26 && direction <= 168.75,
direction >= 168.76 && direction <= 191.25,
direction >= 191.26 && direction <= 213.75,
direction >= 213.76 && direction <= 236.25,
direction >= 236.26 && direction <= 258.75,
direction >= 258.76 && direction <= 281.25,
direction >= 281.26 && direction <= 303.75,
direction >= 303.76 && direction <= 326.25,
direction >= 236.26 && direction <= 348.75
]
I've been trying to do it like this:
Code:
switch(dir) {
case dir[0]: show_debug_message("It's on direction 0");
case dir[1]: show_debug_message("It's on direction 1");
break;
}
But it's not returning anything, i don't know the best way to do this so any ideas and directions will help a lot!
Thx in advance!