Video of the Glitch
Been following a couple video tutorials on YouTube, but my character slowly slides down any walls that he comes in contact with if you're holding the direction towards the wall.
if !global.on_ice:
if global.left and !global.right:
x_speed = -MAX_RUN_SPEED
elif !global.left and global.right:
x_speed = MAX_RUN_SPEED
else:
x_speed = 0
else:
if global.left and !global.right and x_speed > -MAX_RUN_SPEED:
x_speed -= ICE_ACCEL
elif !global.left and global.right and x_speed < MAX_RUN_SPEED:
x_speed += ICE_ACCEL
else:
if x_speed > 0:
x_speed -= ICE_ACCEL
if x_speed < 0:
x_speed += ICE_ACCEL
x_speed = clamp(x_speed, -MAX_RUN_SPEED, MAX_RUN_SPEED)
y_speed += GRAVITY * delta
if y_speed > MAX_GRAV:
y_speed = MAX_GRAV
velocity.x = x_speed * delta
velocity.y = y_speed * delta
#Move the sprite and handle collisions
var motion = move(velocity)
#Check for collision
if is_colliding():
var n = get_collision_normal()
var final_motion = n.slide(motion)
velocity = n.slide(velocity)
#Reset Y Speed
y_speed = 0
#Move the player.
move(final_motion)