1 | function joystick_direction(argument0) //gml_Script_joystick_direction |
2 | { |
3 | var jid = __joystick_2_gamepad(argument0) |
4 | var haxis = gamepad_axis_value(jid, gp_axislh) |
5 | var vaxis = gamepad_axis_value(jid, gp_axislv) |
6 | var dir = 0 |
7 | if (vaxis < -0.3) |
8 | dir = 6 |
9 | else if (vaxis > 0.3) |
10 | dir = 0 |
11 | else |
12 | dir = 3 |
13 | if (haxis < -0.3) |
14 | dir += 1 |
15 | else if (haxis > 0.3) |
16 | dir += 3 |
17 | else |
18 | dir += 2 |
19 | return (96 + dir); |
20 | } |