Use this space for questions related to what you're learning. For any other type of support (website, learning platform, payments, etc...) please get in touch using the contact form.
Updating to Godot 4ChepChafThere were some changes on using Tween on Godot 4.
```gdscript
# It is not a Scene Node anymore but it's own class
@onready var _tween: Tween
# Added a reset function for comodity
func reset_tween() -> void:
if _tween:
# Kill the tween if it is already playing
_tween.kill()
# It is not created from the scene tree class
_tween = create_tween()
# New syntax for connect
_tween.finished.connect(_on_Tween_tween_all_completed)
...
func _unhandled_input(event: InputEvent) -> void:
if event.is_action_pressed("ui_accept"):
if _blinking_arrow.visible:
emit_signal("next_requested")
else:
if _tween:
# Instead of seek it is not custom_step
_tween.custom_step(INF)
...
func _begin_dialogue_display() -> void:
reset_tween()
var character_count := _rich_text_label.get_total_character_count()
_rich_text_label.visible_characters = 0
# Instead of interpolate_property
_tween.tween_property(
_rich_text_label, "visible_characters", character_count, character_count / display_speed
)
# Instead of start
_tween.play()
```
Other notes on moving to Godot 4
- `yield` was deprecated, so instead of
```gdscript
yield(_anim_player, "animation_finished")
```
use:
```gdscript
await _anim_player.animation_finished
```
- export and onready not have an at in front (@)
```gdscript
@export var bbcode_text: String = "" : set = set_bbcode_text
@onready var _rich_text_label: RichTextLabel = $RichTextLabel
```10Jul. 05, 2024
Lesson Q&A
Use this space for questions related to what you're learning. For any other type of support (website, learning platform, payments, etc...) please get in touch using the contact form.