P
PepticPaladin
Guest
I wanted to implement a "dash" feature in my game, and I would like to do it by having the player press a movement key twice quickly. I could probably do this rather easily if I ere only using keyboard, but I also want controller support, and I'm having trouble with detecting 2 quick inputs using a joystick.
This is my input code:
This is my input code:
Code:
xinput = keyboard_check(vk_right) - keyboard_check(vk_left);
yinput = keyboard_check(vk_up) - keyboard_check(vk_down);
var leftanalogH = abs(gamepad_axis_value(0,gp_axislh));
var leftanalogV = abs(gamepad_axis_value(0,gp_axislv));
if (leftanalogH > 0.2)
{
xinput = (max(gamepad_axis_value(0,gp_axislh),0) - abs(min(gamepad_axis_value(0,gp_axislh),0)));
gamepad = true;
}
if (leftanalogV > 0.2)
{
yinput = -(max(gamepad_axis_value(0,gp_axislv),0) - abs(min(gamepad_axis_value(0,gp_axislv),0)));
gamepad = true;
}
xmovement = xinput * __accel;
ymovement = yinput * __accel;