Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

mintymunchies

9
Posts
1
Topics
3
Followers
A member registered Jan 17, 2024 · View creator page →

Creator of

Recent community posts

thank you!

thank you! i'll keep in mind to test everything more thoroughly for the future 

thank you! unfortunately no it's a bug but I still can't understand where it is actually because it works fine for me TT

i can't believe how polished this game is! good job :))

thank you so much! so sorry about the bugs, could you tell me what happens and on what platform? I can't get the same behaviours for the life of me!

i'm sorry :( it works fine for me. are you playing on browser or .exe?

thank you! when did it not work?

If you're talking about the red button at the end it's supposed to close the game if you play the Windows version, nothing happens in the browser

(1 edit)

Hey! It's my first time making a game and I made a simple dialogue manager in godot. Thought it might be useful to put it out here


Here's the script (sorry about the formatting):

class_name Dialogue

extends Node2D

@onready var dialogue_animation_player: AnimationPlayer = $AnimationPlayer

@onready var arrow_animation_player: AnimationPlayer = $TextureRect/AnimationPlayer

@onready var dialogue_node_2d: Dialogue = $"."

@onready var text_label: Label = $TextureRect/Label

@onready var timer: Timer = $TextureRect/Timer

signal dialogue_started()

signal dialogue_ended()

signal text_ended(idx: int)

var texts = [

{ "text": "", "auto": false },

]

var curr_text = 0

var curr_letter = 0

var dialogue_on = false

# Called when the node enters the scene tree for the first time.

func _ready() -> void:

arrow_animation_player.play("wiggle_arrow")

# Called every frame. 'delta' is the elapsed time since the previous frame.

func _process(delta: float) -> void:

pass

func start_dialogue():

dialogue_on = true

dialogue_started.emit()

dialogue_animation_player.play("show")

dialogue_node_2d.show()

set_text(texts[0].text)

func next():

if curr_text == texts.size() - 1:

dialogue_on = false

dialogue_ended.emit()

dialogue_animation_player.play("hide")

text_label.text = ""

curr_text = 0

else:

curr_text += 1

set_text(texts[curr_text].text)

func set_text(text: String):

text_label.text = ""

curr_letter = 0

timer.start(0.025)

timer.timeout.connect(add_letter)

func add_letter():

if curr_letter == texts[curr_text].text.length():

text_ended.emit(curr_text)

timer.stop()

if texts[curr_text].auto:

next()

else:

text_label.text += texts[curr_text].text[curr_letter]

curr_letter += 1

func _input(event: InputEvent) -> void:

if dialogue_on && event.is_action_pressed("lmb"):

next()