Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Make float dialog follow character #430

Merged
merged 2 commits into from
Nov 11, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions addons/escoria-dialog-simple/types/floating.gd
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ func _ready():
$Tween.connect("tween_completed", self, "_on_dialog_line_typed")


func _process(delta):
# Position the RichTextLabel on the character's dialog position, if any.
rect_position = _current_character.get_node("dialog_position") \
.get_global_transform_with_canvas().origin
rect_position.x -= rect_size.x / 2


# Make a character say something
#
# #### Parameters
Expand All @@ -57,9 +64,11 @@ func say(character: String, line: String) :

# Position the RichTextLabel on the character's dialog position, if any.
_current_character = escoria.object_manager.get_object(character).node
rect_position = _current_character.get_node("dialog_position").get_global_transform_with_canvas().origin
rect_position = _current_character.get_node("dialog_position") \
.get_global_transform_with_canvas().origin
rect_position.x -= rect_size.x / 2

# Start talking animation
_current_character.start_talking()

# Set text color to color set in the actor
Expand All @@ -76,9 +85,10 @@ func say(character: String, line: String) :
0.0, 1.0, time_show_full_text,
Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
tween.start()
set_process(true)


# Called by the dialog player when the
# Called by the dialog player when user wants to finish dialog fast.
func speedup():
if not _is_speeding_up:
_is_speeding_up = true
Expand All @@ -102,4 +112,5 @@ func _on_dialog_finished():
# Make the speaking item animation stop talking, if it is still alive
if is_instance_valid(_current_character) and _current_character != null:
_current_character.stop_talking()
set_process(false)
StraToN marked this conversation as resolved.
Show resolved Hide resolved
emit_signal("say_finished")