What's wrong with this code

it tells me that its incorrect

extends CharacterBody2D

const speed = 100

func _physics_process(delta):
player_movement(delta)

func player_movement(delta):

if input.is_action_just_pressed(ui_right):
	velocity.x = speed 
	velocity.y = 0
	elif input.is_action_just_pressed(ui_left):
	velocity.x = -speed 
	velocity.y = 0
	if input.is_action_just_pressed(ui_down):
	velocity.x = speed 
	velocity.y = 0
	elif input.is_action_just_pressed(ui_up):
	velocity.x = -speed 
	velocity.y = 0
else:
	velocity.x = 0
	velocity.y = y 
	
	move_and_slide()

GDScript is case sensitive. Use Input, not input.

oh i will try that now

Thank you it worked

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.