Script not executing at all

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By MicroHero
class_name Player, "res://player/PlayerIcon.png"
extends KinematicBody2D


export var max_velocity : float
export var acceleration : float
export var friction : float


var velocity : Vector2 = Vector2.ZERO
var direction : Vector2 = Vector2.ZERO


func ready():
    print("Hello?")


func physics_process(_delta : float) -> void:
	if direction != Vector2.ZERO:
		velocity = velocity.linear_interpolate(direction * max_velocity, acceleration)
	else:
		velocity = velocity.linear_interpolate(Vector2.ZERO, friction)
	
	velocity = move_and_slide(velocity)


func unhandled_input(event : InputEvent) -> void:
	if event is InputEventKey:
		if event.is_pressed():
			if event.is_action("move_north") and direction.y > -1.0:
				direction.y -= 1.0
			elif event.is_action("move_south") and direction.y < 1.0:
				direction.y += 1.0
			
			if event.is_action("move_west") and direction.x > -1.0:
				direction.x -= 1.0
			elif event.is_action("move_east") and direction.x < 1.0:
				direction.x += 1.0
		
		elif not event.is_pressed():
			if event.is_action("move_north") and direction.y < 0.0:
				direction.y += 1.0
			elif event.is_action("move_south") and direction.y > 0.0:
				direction.y -= 1.0
			
			if event.is_action("move_west") and direction.x < 0.0:
				direction.x += 1.0
			elif event.is_action("move_east") and direction.x > 0.0:
				direction.x -= 1.0

KinematicBody2D is in the scene that I’m trying to run and, yet, absolutely nothing is happening when I try to run the scene at all (Play, Play Scene, Play Custom Scene, nada). I’m not even getting a “Hello?” on the terminal.

The export variables are appearing in the inspector, which is all the more confusing.

I have no idea why I can’t even get the “Hello?”. Any help would be appreciated. Thanks.

:bust_in_silhouette: Reply From: Calinou

Your functions should be called _ready(), _physics_process() and _unhandled_input() instead of ready(), physics_process() and unhandled_input(). The leading underscore is important :slight_smile: