All Questions


Tetteh Nartey

Toggle switch

What key was I supposed to press to switch between "Idle" and "Run" states?
  • I just tested your demo, and the code isn't running because your method names are incorrect in the Run and Idle state nodes:

    func unhandled_key_input(event: InputEvent) -> void:

    You named the function "unhandled_key_input" instead of the one that the StateMachine is calling, "unhandled_input". So your states never do anything.

  • N
    Tetteh Nartey replied

  • If nothing is happening for you, you probably missed a step. Possible and common issues include:

    • You forgot to assign a script to the corresponding node. For example, maybe your Idle node doesn't have the script attached to it.
    • You didn't set the initial state path in the StateMachine node. So no state is running, and state transitions can't work.

    Could you check both of these? If after trying you're still stuck, please upload your project as a .zip file to a platform like wetransfer or google drive and send it to me. I'll check the source code directly - otherwise it's hard to know where the problem is.

  • N
    Tetteh Nartey replied

    The game doesn't seem to switch between "Run" and "Idle". I still only get the default "text".

  • In the video, we use ui_accept, that is defined by Godot by default. Among other keys, pressing Enter should trigger this input event.