G
GalGames
Guest
My sprite keeps with its way when it should stop because there are blocks with collision codes
Why I get this error? (CODE BELOW)
Code:
/// @description Desplazamiento
//Desplazamiento horizontal
var keyLeft, keyRight;
keyLeft = keyboard_check(vk_left);
keyRight = keyboard_check(vk_right);
//Velocidad horizontal
if (keyLeft) Vx = -1;
else if (keyRight) Vx = 1;
x += Vx;
//Colisión Horizontal
repeat(abs(Vx))
{
if (!place_meeting(x + Vx,y,obj_block))
{
x += Vx;
}
else
{
Vx = 0;
break;
}
}