feat: basic dialogue system and opening cutscene
This commit is contained in:
21
main.gd
21
main.gd
@ -1,35 +1,28 @@
|
||||
extends Node2D
|
||||
|
||||
|
||||
@onready var next_dialogue: MarginContainer = %NextDialogue
|
||||
@onready var bubbles: HBoxContainer = $Bubbles
|
||||
@onready var bubbles_back: TileMapLayer = $BubblesBack
|
||||
@onready var bubbles_interior: TileMapLayer = $BubblesInterior
|
||||
|
||||
var active_camera: SuperCamera
|
||||
|
||||
@onready var opening_cutscene: AnimationPlayer = $OpeningCutscene
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
for child in get_children():
|
||||
if is_instance_of(child, SuperCamera):
|
||||
child.became_active.connect(on_camera_became_active)
|
||||
|
||||
opening_cutscene.play("opening_cutscene")
|
||||
|
||||
func on_camera_became_active(camera: SuperCamera):
|
||||
active_camera = camera
|
||||
|
||||
|
||||
func on_dialogue_started():
|
||||
bubbles.visible = true
|
||||
bubbles_back.visible = true
|
||||
bubbles_interior.visible = true
|
||||
|
||||
func on_dialogue_ended():
|
||||
bubbles.visible = false
|
||||
bubbles_back.visible = false
|
||||
bubbles_interior.visible = false
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
bubbles.global_position.x = active_camera.global_position.x - 270.0
|
||||
next_dialogue.global_position.x = active_camera.global_position.x + 133.0
|
||||
bubbles_back.global_position.x = active_camera.global_position.x
|
||||
bubbles_interior.global_position.x = active_camera.global_position.x
|
||||
|
||||
|
Reference in New Issue
Block a user