N
Nuco.Ampuero
Guest
Hi, I have some issues with my horizontal movement code.
I have a global variables in the Step Event of my object Player for the horizontal move:
global.input_key_left = keyboard_check(vk_left) || gamepad_axis_value(0, gp_axislh) < -0.5 || gamepad_button_check(0,gp_padl);
global.input_key_right = keyboard_check(vk_right) || gamepad_axis_value(0, gp_axislh) > 0.5 || gamepad_button_check(0,gp_padr);
And I want to call it in the same Step Evcent for action with this code:
//////////////////
// MOVING
//////////////////
if (global.input_key_left) //and state!=jump
{
if state!=jump && state!=ladder && state!=fall
{
state=run
xspd=-3;
framerate=0.5
sprite_index=spr_plr_Run
}
}
if (global.input_key_right) //and state!=jump
{
if state!=jump && state!=ladder && state!=fall
{
state=run
xspd=3;
framerate=0.5
sprite_index=spr_plr_Run
}
}
The problem is that the code works with the keyboard and not with the joystick or any Gamepad Input.
What I'm doing wrong?
I have a global variables in the Step Event of my object Player for the horizontal move:
global.input_key_left = keyboard_check(vk_left) || gamepad_axis_value(0, gp_axislh) < -0.5 || gamepad_button_check(0,gp_padl);
global.input_key_right = keyboard_check(vk_right) || gamepad_axis_value(0, gp_axislh) > 0.5 || gamepad_button_check(0,gp_padr);
And I want to call it in the same Step Evcent for action with this code:
//////////////////
// MOVING
//////////////////
if (global.input_key_left) //and state!=jump
{
if state!=jump && state!=ladder && state!=fall
{
state=run
xspd=-3;
framerate=0.5
sprite_index=spr_plr_Run
}
}
if (global.input_key_right) //and state!=jump
{
if state!=jump && state!=ladder && state!=fall
{
state=run
xspd=3;
framerate=0.5
sprite_index=spr_plr_Run
}
}
The problem is that the code works with the keyboard and not with the joystick or any Gamepad Input.
What I'm doing wrong?