#### HaloElite

##### Member

Code:

```
if(keyboard_check(vk_left)){
hsp = -4;
}else if(keyboard_check(vk_right)){
hsp = 4;
}else {
hsp = 0;
}
// Slow down opposite x-movement when jumping
if(sign(hsp) == 1 && moveL || sign(hsp) == -1 && moveR) hsp /= 2;
if(sliding == true) hsp *= 2;
// When hitting a slope
if(place_meeting(x + hsp, y, solids)){
yplus = 0;
// Checks height of slope
while(place_meeting(x+hsp, y-yplus, solids) && yplus <= abs(1*hsp)) yplus += 1;
// Walks
if(place_meeting(x+hsp, y-yplus, solids)){
// Walks x-wise
while(!place_meeting(x+sign(hsp), y, solids)) x += sign(hsp);
hsp = 0;
}else{
// Walks y-wise
y -= yplus;
}
}
x + hsp;
```

e.g: While touching the slope and walking to the right and pressing vk_left and then vk_right again it's stuck instead of walking.

The error just occurs when changing direction like: walking right - changing to left - trying to walk right again - stuck.

Best regards,

me