Player moving one at a time(URGENT)

so when I move the player i move one at a time so i have to click a or d every time to move the player

My Problem Explained as Video

### Code on basic 2D platformer + animations by IcyEngine

extends CharacterBody2D

@export var walk_speed = 150.0
@export var run_speed = 250.0
@export_range(0, 1) var acceleration = 0.1
@export_range(0, 1) var deceleration = 0.1

@export var jump_force = -400.0
@export_range(0, 1) var decelerate_on_jump_release = 0.5

@export var dash_speed = 1000.0
@export var dash_max_distance = 300.0
@export var dash_curve : Curve
@export var dash_cooldown = 1.0

@export var animated_sprite : AnimatedSprite2D

var rank : String = "Academy Student" #default rank

# Get the gravity from the project settings to be synced with RigidBody nodes.
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")

var is_dashing = false
var dash_start_position = 0
var dash_direction = 0
var dash_timer = 0

func _physics_process(delta):
	# Add the gravity.
	if not is_on_floor():
		velocity.y += gravity * delta

	var speed
	if Input.is_action_pressed("Move_Run"):
		speed = run_speed
	else:
		speed = walk_speed

	# Get the input direction and handle the movement/deceleration.
	# As good practice, you should replace UI actions with custom gameplay actions.
	var direction = Input.get_axis("Move_Left", "Move_Right")
	if direction:
		velocity.x = move_toward(velocity.x, direction * speed, speed * acceleration)
		animated_sprite.flip_h = direction == -1
		if is_on_floor():
			if Input.is_action_pressed("Move_Run"):
				match rank:
					"academy student":
						animated_sprite.play("Walk")
			else:
				match rank:
					"academy student":
						animated_sprite.play("Walk")
	else:
		velocity.x = move_toward(velocity.x, 0, walk_speed * deceleration)
		if is_on_floor():
			match rank:
				"academy student":
					animated_sprite.play("Idle")

	# Handle jump.
	if Input.is_action_just_pressed("Jump") and (is_on_floor() or is_on_wall()):
		velocity.y = jump_force
		match rank:
			"academy student":
				animated_sprite.play("Jump")

	if Input.is_action_just_released("Jump") and velocity.y < 0:
		velocity.y *= decelerate_on_jump_release

	# Dash activation
	if Input.is_action_just_pressed("Move_dash") and direction and not is_dashing and dash_timer <= 0:
		is_dashing = true
		dash_start_position = position.x
		dash_direction = direction
		dash_timer = dash_cooldown

	# Performs actual dash
	if is_dashing:
		var current_distance = abs(position.x - dash_start_position)
		if current_distance >= dash_max_distance or is_on_wall():
			is_dashing = false
		else:
			velocity.x = dash_direction * dash_speed * dash_curve.sample(current_distance / dash_max_distance)
			velocity.y = 0

	# Reduces the dash timer
	if dash_timer > 0:
		dash_timer -= delta

	move_and_slide()

have you tried restarting your editor when trying your code my machine I was able to move without having to press it over and over again,

also in your video the player script is not attached

It is I was editing the player stuff

yeah that happens to me

from what I can tell your player is stuck in the floor.

if you move your player up in the node_2d scene it should be fine, how does the collision on your tilemap look?

if you click this

does it look messed up when you click play?

I think this is what is happening that is causing you to have to keep pressing left or right:

you want it to be like this:

yep my player is stucked to the floor

okay I changed my Collison capsule location and its not stucked to the floor but it still doing that

can you send a picture of the game playing when you have this checked

Screen recording 2025-12-10 1.58.15 PM

ignore the massive blue thing, its the gif problem not mines

From my testing I can’t find anything wrong unless you changed a value in the inspector panel on your player ): sorry i couldn’t be of more help.

maybe trying to redo the player script from the beginning (start again with only moving left and right) and slowly adding the rest of the features (dash, jump, sprint, animations)back would help find the issue?

What happens if you change the player collider to box?

still does the same thing

what is this set to?

I feel we need more information to find a problem.

if you create a new scene with a StaticBody2D and a collision and add you player does the same thing happen?

make sure to add a shape to the CollisionShape2D and make the size.x = 1000

don’t forget to re add your player script

also set the transform of the player to -96px

the reason I am asking you to do this is to see

  • if the problem is with your instance of godot
  • if the problem is within the node_2d scene

before you test make sure this is turned on to tell where the floor is

to test the new scene click this button to play the current scene

what I don’t get what ur trying to say

We need to isolate where the problem is, is it in the node_2d scene?

Maybe something is weird with the collision in your TileMapLayer or something weird happened with the player script in that scene.

I am asking you to create a new scene to see if the problem happens again, if it doesn’t then we know for sure that the browser Godot you are using isn’t the problem and we can for sure rule that out.

Because maybe it could be a problem like this:

but I want to make sure we are not chasing something that isn’t a problem with your current scene but with web Godot itself

ANYONE PLZ HELP

(full)