Ping pong movement not working

Godot Version

Question

I need help to figure out why my character wont move

This is my movement scripts i have set the mapped keys as well.

extends RigidBody2D

@export var speed = 500

func physics_process(_delta):
var _movement = Vector2.ZERO
if Input.is_action_pressed(“Move_up”):
_movement = Vector2.UP
elif Input.is_action_pressed(“Move_down”):
_movement = Vector2.DOWN

	linear_velocity = _movement + speed

I believe it would make more sense to multiply instead of add:

linear_velocity = _movement * speed

Also since the time between consecutive physics_process calls differs, you should include the delta time and adjust speed accordingly:

func physics_process(delta):
    [...]
    linear_velocity = _movement * speed * delta

You are completly right it would make more sense. Sadly my paddle still are not moving for some reason.

Can you check, if the code within the if or the elif section is executed by including print()-statements or by setting breakpoints?

If they are not executed, then you should investigate the input mapping.

If they are executed, then you should investigate linear_velocity. You might find more insight in the RigidBody2D documentation:

Note: Changing the 2D transform or linear_velocity of a RigidBody2D very often may lead to some unpredictable behaviors. If you need to directly affect the body, prefer _integrate_forces as it allows you to directly access the physics state.