Player randomly stopped working

Godot Version

4.3

Question

I changed the input from normal ui_left etc. to left and right and suddenly the gravity stopped working, how do i fix this?

`extends CharacterBody2D

const SPEED = 600.0
const JUMP_VELOCITY = -900.0

Get the gravity from the project settings to be synced with RigidBody nodes.

var gravity = 1000
var jump_count = 0
var extrajumps = 1

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

#doublejump
if doublejump.doublejump == 1:
	extrajumps = 1
else:
	extrajumps = 0

if doublejump.doublejump == 1:
	if Input.is_action_just_pressed("jump") and jump_count < extrajumps:
		velocity.y = JUMP_VELOCITY
		jump_count += 1
else:
	if Input.is_action_just_pressed("jump") and is_on_floor():
		velocity.y = JUMP_VELOCITY
		jump_count += 1
		
		

		
	
# Handle jump.
if is_on_floor():
	jump_count = 0

# 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("left", "right")
if direction:
	velocity.x = direction * SPEED
else:
	velocity.x = move_toward(velocity.x, 0, SPEED)
	
	var isLeft = velocity.x < 0

func player():
pass

move_and_slide()

`

add the jump velocity instead of setting it:

if doublejump.doublejump == 1:
	if Input.is_action_just_pressed("jump") and jump_count < extrajumps:
		velocity.y += -JUMP_VELOCITY
		jump_count += 1
else:
	if Input.is_action_just_pressed("jump") and is_on_floor():
		velocity.y += -JUMP_VELOCITY