i have a blocking

Basically what it says, I have an action that blocks another and I do not know how to solve it since it is quite cumbersome and complicated for my programmatic capacity, I explain
in the create event I have some variables for movement, which are the following:

intVX = 0; // horizontal speed
intMove = 0; // move sped
intVYMax = 20; //vertical speed max
intVXMax = 10.5; //horizontal speed max
intGroundAcc = 1 * intMultiplier; // Acc in ground
intGroundFric = 1.9 * intMultiplier; // Fricc in ground
intAirAcc = 0.75 * intMultiplier; // Acc in air
intAirFric = 0.1 * intMultiplier; // Fricc in air

In the event step some of movement that are the following

var keyLeft, keyRight, keyJump, keyJumpRelease; // local var
keyLeft = -(keyboard_check(vk_left) || (gamepad_axis_value(0, gp_axislh) <0)) ; // move left
keyRight = keyboard_check(vk_right) || (gamepad_axis_value(0, gp_axislh) >0) ; // move right
keyJump = keyboard_check_pressed(vk_up) || (gamepad_button_check_pressed(0,gp_face1)) ; // Jump
keyJumpRelease = keyboard_check_released(vk_up) ; // fall

intMove = keyLeft + keyRight || Raton_izq + Raton_der

one script
//scrAproach

if (argument0 < argument1)
return min (argument0 + argument2, argument1);
else
return max (argument0 - argument2, argument1);

And until here everything was great but when I add the following the movement to the left stops working and I have tried everything and nothing works for me but when I attach the code that I am going to show now the left movement stops working also with the keyLeft and I do not know why

Raton_der = 0
Raton_izq = 0
if mouse_check_button(mb_left) and (mouse_x > ObjRB.x ) {Raton_der = -1}
if mouse_check_button(mb_left) and (mouse_x < ObjRB.x ) {Raton_izq = 1}

Please, it is very urgent and surely it is a chick but I do not give it to her
thanks for all
 

Simon Gust

Member
The problem probably lies in your intMove variable.
This is not how or-operators work.
To visualise what's happening, look at the code your compiler is actually seeing
Code:
intMove = ((keyLeft + keyRight) > 0  || (Raton_izq + Raton_der) > 0)
This line is no longer math, it is a statement. IntMove will only return 1 or 0 (true or false) now.
->
Code:
intMove = clamp((keyLeft + keyRight) + (Raton_izq + Raton_der), -1, 1);
I didn't test this.
 
The problem probably lies in your intMove variable.
This is not how or-operators work.
To visualise what's happening, look at the code your compiler is actually seeing
Code:
intMove = ((keyLeft + keyRight) > 0  || (Raton_izq + Raton_der) > 0)
This line is no longer math, it is a statement. IntMove will only return 1 or 0 (true or false) now.
->
Code:
intMove = clamp((keyLeft + keyRight) + (Raton_izq + Raton_der), -1, 1);
I didn't test this.
JAJAJAJAJAJAJAJAJAJAJJAJAJAJAJA
JAJAJAJAJAJJAJAJAJAJAJJAJAJAJAJA
JAJAJAJAJAJAJAJAJAJAJAJAJAJAJAJA

I laugh a lot because it has solved my problem, thank you very much, do not know how much I appreciate it and how much I needed to do, Thanks really.
 
Top