change_emotion

This commit is contained in:
Maurane
2025-06-11 15:58:56 +02:00
parent 9b35d6ed82
commit 22caef38fc
20 changed files with 201 additions and 294 deletions
+52 -9
View File
@@ -7,6 +7,7 @@ extends Control
@onready var face_zoom = $Background/HBoxContainer/MarginContainer/VBoxContainer/FaceMarginContainer/FaceZoom
@onready var alone_controls = $Background/HBoxContainer/MarginContainer/VBoxContainer/ControlsMarginContainer/Alone
@onready var patient_controls = $Background/HBoxContainer/MarginContainer/VBoxContainer/ControlsMarginContainer/Patient
@onready var patient_texture = $Background/HBoxContainer/Desk/PatientTextureRect
@onready var dialogue_resource: Resource
@onready var balloon: Node
@onready var patient_emotions : Dictionary
@@ -29,7 +30,7 @@ func _ready() -> void:
patient_controls.get_node("Examine").pressed.connect(self._examine)
#Instantiating a custom balloon
var Balloon: Resource = load("res://Dialogues/balloon.tscn")
var Balloon: Resource = preload("res://Dialogues/balloon.tscn")
balloon = Balloon.instantiate()
var panel = balloon.get_node("Balloon/Panel")
@@ -44,6 +45,7 @@ func _ready() -> void:
panel_container.hide()
face_zoom.hide()
patient_controls.hide()
patient_texture.hide()
@@ -53,9 +55,6 @@ func gameplay_loop(patient_id):
func new_patient(patient_id):
#Loading Patient Files
@@ -70,13 +69,28 @@ PATIENT FILE #" + String(patient_id)
file.close()
#Loading Patient Texture
file_path = "res://Art/Patients/patient_" + String(patient_id) + "/patient_" + String(patient_id) + "_full.png"
patient_texture.texture = load(file_path)
#Loading Face Emotions
#Neutral
var face: Resource
var emotion: Dictionary
#Neutral
file_path = "res://Art/Patients/patient_" + String(patient_id) + "/patient_" + String(patient_id) + "_neutral.png"
var face = load(file_path)
var emotion = {"neutral": face}
face = load(file_path)
emotion = {"neutral": face}
patient_emotions.merge(emotion)
#Smiling
file_path = "res://Art/Patients/patient_" + String(patient_id) + "/patient_" + String(patient_id) + "_smiling.png"
face = load(file_path)
emotion = {"smiling": face}
patient_emotions.merge(emotion)
#Loading Default Face
face = patient_emotions["neutral"]
face_zoom.texture = face
@@ -109,9 +123,21 @@ func _guidebook():
func _call_next_patient():
#Hiding and Showing appropriate scenes
#alone_controls.hide()
#patient_controls.show()
#patient_texture.show()
#_examine()
var scenes_to_hide = margin_container.get_children()
scenes_to_hide.append_array([alone_controls,panel_container])
TransitionScreen.transition("big", scenes_to_hide, [patient_controls,patient_texture,face_zoom])
await TransitionScreen.transition_finished
#Starting Dialogue
DialogueManager.got_dialogue.connect(_change_emotion)
balloon.start(dialogue_resource, "start")
alone_controls.hide()
patient_controls.show()
@@ -134,6 +160,23 @@ func _examine():
func _change_emotion(dialogue_line) -> void:
var line_tag = dialogue_line.tags
var new_emotion
if line_tag.is_empty() == false:
new_emotion = line_tag[0]
print("Emotion changed to ", new_emotion)
face_zoom.texture = patient_emotions[new_emotion]
pass
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass