#I need help following this godot tutorial

3 messages · Page 1 of 1 (latest)

neon lynx
#

side by side, left is the video, right is my godot project getting a game breaking error?

#

i found the github for the video's code, i copied and pasted it in and it still had this error, how would this function work in the newest build of godot then?

#
func _physics_process(delta):
    if(current_state.next_state != null):
        switch_states(current_state.next_state)
        
    current_state.state_process(delta)

func check_if_can_move():
    return current_state.can_move


func switch_states(new_state : State):
    if(current_state != null):
        current_state.on_exit() <-- (The error "Cannot call non-static function "on_exit()" on the class "State" directly")
        current_state.next_state = null
    
    current_state = new_state
    
    current_state.on_enter()

func _input(event : InputEvent):
    current_state.state_input(event)```