Godot Version
4.4
Hello, I am new to coding, and I am attempting to make some dialogue for my game. The functionality I want is for it to both be animated dialogue, so it animates as it types on screen, and advances when I click a button, which I’ve already found a tutorial for.
This is the tutorial I followed for that:
What I would like to do now, is to have the ability to use either my input (i.e. left clicking on my mouse, which I’ve already set up), or my button to skip the animated dialogue section to show all of the dialogue at once. Then be able to click again and advance it to the next bit of dialogue.
I feel like this is a very common function in most video games, I know I certainly use it when I feel like the typewriter style animation is too slow. Which is why I’d like to have it implemented. But I just can’t seem to find any tutorials for this specific kind of dialogue option. I would really appreciate any help, thank you so much in advance.
This is my current code, and the specific problem area that I’m trying to get working. I figured this would have worked, but I tested this input with print() functions, and it doesnt seem to be even registering my input.
extends Control
@onready var start = $Start as Button
@export var start_game = preload("res://Scenes/Contest Scene/contest_v_01.tscn") as PackedScene
var _message_index = 0
@export var text_lines : Array[String]
func _ready() -> void:
start.button_down.connect(on_start_pressed)
$Start.hide()
$Panel/MarginContainer/Panel/MarginContainer/Advance_Text.hide()
%Label.text = text_lines[_message_index]
$Scrolling_Text.play("Intro_Dialogue")
if Input.is_action_just_pressed("CONTINUE") and $Scrolling_Text.is_playing():
$Scrolling_Text.seek(.9, true)
else:
await $Scrolling_Text.animation_finished
$Panel/MarginContainer/Panel/MarginContainer/Advance_Text.show()
func next_message() -> void:
_message_index += 1
if %Label.text == "My name is Barry, I am a Performand breeder, and I will be your guide in this wonderful world.":
$AnimationPlayer.play("new_animation")
await $AnimationPlayer.animation_finished
else:
pass
if _message_index >= text_lines.size():
$Panel/MarginContainer/Panel/MarginContainer/Advance_Text.hide()
$Start.show()
else:
%Label.text = text_lines[_message_index]
$Scrolling_Text.play("Intro_Dialogue")
await $Scrolling_Text.animation_finished
$Panel/MarginContainer/Panel/MarginContainer/Advance_Text.show()
func _on_next_button_pressed():
$Panel/MarginContainer/Panel/MarginContainer/Advance_Text.hide()
next_message()
func on_start_pressed() -> void:
get_tree().change_scene_to_packed(start_game)
The problem area:
if Input.is_action_just_pressed("CONTINUE") and $Scrolling_Text.is_playing():
$Scrolling_Text.seek(.9, true)
else:
await $Scrolling_Text.animation_finished
My attempt at print functions:
if Input.is_action_just_pressed("CONTINUE") and $Scrolling_Text.is_playing():
$Scrolling_Text.seek(.9, true)
print("True")
else:
await $Scrolling_Text.animation_finished
print("false")
This only prints the false, so my Input doesn’t seem to be registering at all?