my movement isnt working

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By yellowJUSTice

whenever i try and move my charchter in godot it dosent move it moved before but now the charchters just stopped the animations are working tho

script -

extends KinematicBody2D
class_name player

var velocity = Vector2.ZERO

export (Resource) var moveData
func physicsprocess(_delta):
	apply_gravity()
	var input = Vector2.ZERO
	input.x = Input.get_action_strength("ui_right")- Input.get_action_strength("ui_left")
	
	if input.x == 0:
		apply_friction()
		$AnimatedSprite.animation = "idle"
	else:
			apply_acceleration(input.x)
			$AnimatedSprite.animation = "run"
			if input.x > 0:
					 $AnimatedSprite.flip_h = true
			elif input.x < 0:
					$AnimatedSprite.flip_h = false
	if is_on_floor():
			if Input.is_action_pressed("ui_up"):
					velocity.y = moveData.JUMP_FORCE
	else:
		if Input.is_action_just_released("ui_up") and velocity.y < moveData.JUMP_RELEASE_FORCE:
			velocity.y = moveData.JUMP_RELEASE_FORCE
		$AnimatedSprite.animation = "jump"

		
	if velocity.y > 0:
			 velocity.y += moveData.ADDITIONAL_FALL_GRAVITY
	velocity = move_and_slide(velocity, Vector2.UP)

func apply_gravity():
		velocity.y += moveData.GRAVITY

func apply_friction():
	velocity.x = move_toward(velocity.x, 0, 100)

func apply_acceleration(ammount):
	velocity.x = move_toward(velocity.x, moveData.MAX_SPEED * ammount, moveData.ACCELERATION)
	pass

func onAnimatedSpriteframechanged():
	pass # Replace with function body.


func _on_AnimatedSprite_frame_changed():
	pass # Replace with function body.

Edited to fix code formatting…

jgodfrey | 2023-03-04 18:57

For starters physicsprocess should be _physics_process. If your live code really has that function named incorrectly, none of the code inside it will ever be executed…

jgodfrey | 2023-03-04 19:00

oh thank you i did not see that at all

yellowJUSTice | 2023-03-04 19:04