#Help fixing this error

9 messages · Page 1 of 1 (latest)

fast cobalt
#

I was following a tutorial but for some reason this error showed up and I dont have a clear understanding why despite its description

fast cobalt
#

`class_name EnemyStateIdle extends EnemyState

@export var anim_name : String = "idle"

@export_category("AI")
@export var state_duration_min : float = 0.5
@export var state_duration_max : float = 1.5
#getting this from enemy_state script class
@export var after_idle_state : EnemyState

var _timer : float = 0.0

func init() -> void:
pass

#when the players enters this state
func Enter() -> void:
enemy.velocity = Vector2.ZERO
_timer = randf_range(state_duration_min, state_duration_max)
enemy.UpdateAnimation(anim_name)
pass

func Exit() -> void:
pass

#what happens during process update
func Process(_delta : float) -> EnemyState:
_timer -= _delta
if _timer <= 0:
return after_idle_state
return null

func Physics(_delta : float) -> EnemyState:
return null

`

olive veldt
# fast cobalt

it says that the function "physics" doesn't exist in the class, probably because you called it "Physics", and function names are case sensitive as far as i know.

fast cobalt
#

Oh no wonder

#

Cant believe a simple oversight like that gave me the error

#

thx

olive veldt
#

and that's why you generally keep the capitalisation of code constant (with how built-in ones already are).