f
fucitcml

func_read()

func _ready() -> void:
    show_line(0)
    # We call the AudioStreamPlayer's stop() function when the text animation
    # completes.
    tween.connect("tween_all_completed", audio_player, "stop")

just want to better understand the func _ready( ) -> void:
what func should i put under func_ready ()?


  • Nathan Lovato replied

    I think that you will see that over time, through many examples. This function allows you to initialize nodes. For example, in this case, if we don't call the show_line() function, the player will see the placeholder text instead of the first line of dialogue when the game starts to run.

    So we use the ready function to show the correct line of text before the dialogue box gets displayed on the screen.

    Then you will very often use the ready function to connect signals if you decide to connect them from code.

    There are many other things that you will do in the ready function and the list could be pretty endless. The general idea is that you use it to set up nodes before they get displayed on screen or used in the game.

    1 love