i am working on a little Game with Pygame and i stumbled across a little thing i couldnt fix by myself. So here is the Problem:

px, py = player_rect.center sx, sy = snail_rect.center direction = (px - sx, py - sy) dx, dy = (px - sx, py - sy) snail_rect.center = (sx + dx / 60, sy + dy / 60)

When i now execute it the snail will speed up the farther it is away from the player. But i now i want that the snail have the same speed no matter how far it is away. Im pretty new and i hope this snipped is enought so you guys can help me ^^

## Answer

You need to normalize your vector to a unit vector and then properly scale it by a constant speed factor. Try this:

import math dx, dy = (px - sx, py - sy) length = math.sqrt(dx*dx + dy*dy) dx /= length dy /= length # you can use this already # or you can do c = 5 dx = c * dx dy = c * dy