velocity
has type Vector
, so you can call length()
to get the speed (pixels per second):
var speed := velocity.length()
(If you use this in _process(delta)
, keep in mind that this method is called multiple times per second, so velocity
(and therefore speed
) need to be multiplied by delta
.)