Player Position Update Issue

Godot Version

Version 4.5

Question

I am making Pong but I cannot update player's position to new position in Ready function. I don't understand if it is clashing with something.

Code

using Godot;
using System;

public partial class Player : CharacterBody2D
{
private int speed = 200;
public override void _Ready()
{
Position = new Vector2(50, 90);
}

public override void _PhysicsProcess(double delta)
{
	walk();
	MoveAndSlide();
}

public void walk()
{
	float moveV = Input.GetAxis("ui_up", "ui_down");
	Vector2 nPo = new Vector2(Position.X, moveV);
	Velocity = nPo * speed;
}

}

Kindly help me,

You took Position.X and shoved it into the Velocity. This means that your Player will be accelerating into the Position.X direction, which you set to 50 in the _Ready().
The Velocity should just be 0 on the X axis.

public void walk()
{
	float moveV = Input.GetAxis("ui_up", "ui_down");
	Vector2 nPo = new Vector2(0, moveV);
	Velocity = nPo * speed;
}

Thanks for your help, I was struggling with this problem since yesterday.