For my VN style dialogue scene I'm trying to implement advancing the scene and/or text whenever a keyboard input is pressed. IE spacebar.
I do not understand exactly when and why we use Input.is_action_pressed or something similar. Or if that is even the correct way to do it.
is there other ways is to do this?
Game_scene.gd:
`extends Node2D
@onready var TextureR = $TextureRect
@onready var dialogue_id = 0
func _ready() -> void:
scene_1_start()
pass
func _process(delta: float) -> void:
pass
func scene_1_start():
$DialogueBox.hide()
await get_tree().create_timer(0.2).timeout
TextureR.texture = load("res://assets/images/scene_1_1.webp")
await get_tree().create_timer(0.6).timeout
$DialogueBox.show()
$DialogueBox.speaker_l.text = "Narrator"
$DialogueBox.dialog_l.text = "You look around the room thinking about the next activity you want to do."
await Input.is_action_pressed("advance")
$DialogueBox.dialog_l.text = "That was until your friend barged in, disrupting your thoughts with her presence."
await Input.is_action_pressed("advance")
TextureR.texture = load("res://assets/images/scene_1_2.webp")
func scene_end():
get_tree().change_scene_to_file("res://assets/main_menu.tscn")`
VN style scene: