# Screwed up something. Character slowly slides down walls.

Attention Topic was automatically imported from the old Question2Answer platform.

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)
``````

Not sure what is causing the problem, but I think that you don’t need to multiply yspeed with delta in velocity.y, becasue you are already adding delta in yspeed above.

pospathos | 2018-12-06 08:52

I require your `move_and_slide` code to see if it could be the problem

shield | 2018-12-08 16:12