Buenas estimados, vengo a solicitar su apoyo en un problema que tengo con el código de mi personaje cuando quiero hacerlo mover con el GamePad.
Tengo unas variables globales para el movimiento horizontal:
[gml]
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);
[/gml]
Y las llamo desde el evento Step con el siguiente codigo:
[gml]
//////////////////
// 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
}
}
[/gml]
El problema esta en que las funciones de teclas trabajan bien, pero no el joystick analógico ni el pad del mando. Alguien sabe como puedo solucionar? o cual ha sido el error que he cometido?.
Gracias.
Tengo unas variables globales para el movimiento horizontal:
[gml]
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);
[/gml]
Y las llamo desde el evento Step con el siguiente codigo:
[gml]
//////////////////
// 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
}
}
[/gml]
El problema esta en que las funciones de teclas trabajan bien, pero no el joystick analógico ni el pad del mando. Alguien sabe como puedo solucionar? o cual ha sido el error que he cometido?.
Gracias.