Godot Version
4.3
Question
I am new to godot and I am trying to make a working ping pong game. I am stuck with the player where I can move player vertically but the pong touches the sides of the player it attaches to it and makes it to move along with untill I press a key.
Here is code of the player
extends CharacterBody2D
@export var speed = 400
func _physics_process(delta):
velocity = Vector2.ZERO
player_movement()
move_and_slide()
print("Velocity.x:", velocity.x)
print("Velocity.y:", velocity.y)
func player_movement():
# Getting Y axis strength
var movement_store = Input.get_action_strength("ui_down") - Input.get_action_strength("ui_up")
velocity.y = movement_store * speed
velocity.x = 0