src / dialogue / chapters / 1 / young_guy / young_guy.tscn

Diagram

Diagram

Assets

200
200
200
200
200
200

Overridden virtual functions

_ready

func _ready() -> void:
	if not owner: start()
$Bonfire
func _ready() -> void:
	if on_fire: fire()
	else: wood()

_input

func _input(event_: InputEvent) -> void:
	if not state == State.ENTERED: return
	if event_.is_action_pressed(&'dialogue_start'):
		start()
$Dialogue
func _input(_event: InputEvent) -> void:
	if not started: return
	if waiting: return
	if _event.is_action_pressed('ui_accept'):
		continue_dialogue()

Scene Tree

Signal Connections

$.:[area_entered]⇒$.
func _on_area_entered(_area: Area2D) -> void:
	if not state == State.FINISHED: enter()
$.:[area_exited]⇒$.
func _on_area_exited(_area: Area2D) -> void:
	if not state == State.FINISHED: exit()
$Dialogue:[event]⇒$.
func _on_dialogue_event(event_name: String) -> void:
	if %AnimationPlayer.has_animation(event_name):
		%AnimationPlayer.play(event_name)
	event.emit(event_name)
$Dialogue:[finished]⇒$.
func _on_dialogue_finished() -> void:
	finish()
$Dialogue:[paused]⇒$.
func _on_dialogue_paused() -> void:
	stop()

Animations

01.zoom

Diagram

Animation_k41nd

Diagram

finish

Diagram

Properties

Table 1. Root properties
Name Value

collision_layer

0

collision_mask

16

script

Table 2. $Dialogue properties
Name Value

unique_name_in_owner

true

visible

false

boot_file

speakers

Array("[SubResource("Resource_htrph"), SubResource("Resource_lctda")]")

Table 3. $YoungGuy properties
Name Value

position

Vector2(233.99998, 228)

Table 4. $YoungGuy/Speech properties
Name Value

unique_name_in_owner

true

position

Vector2(-0.18181577, -35.999996)

scale

Vector2(0.3227273, 0.3227273)

texture

SpeechBubble
Figure 1. res://assets/images/stages/speech/SpeechBubble.svg
Table 5. $YoungGuy/Speech/ButtonB properties
Name Value

unique_name_in_owner

true

visible

false

position

Vector2(-0.28169644, -4.3661833)

scale

Vector2(0.83098614, 0.83098614)

texture

ButtonB
Figure 2. res://assets/images/stages/speech/ButtonB.svg
Table 6. $YoungGuy/Speech/Silence properties
Name Value

unique_name_in_owner

true

texture

Silence
Figure 3. res://assets/images/stages/speech/Silence.svg
Table 7. $Bonfire properties
Name Value

light_mask

0

position

Vector2(379.99988, 188.00024)

Table 8. $Tent properties
Name Value

position

Vector2(-89, 261)

scale

Vector2(6, 6)

texture

Tent
Figure 4. res://assets/images/stages/chapter1/Tent.png
Table 9. $CollisionShape2D properties
Name Value

position

Vector2(563, 121)

shape

SubResource("RectangleShape2D_jawxq")

Table 10. $Camera2D properties
Name Value

position

Vector2(364, -1)

enabled

false

Table 11. $AnimationPlayer properties
Name Value

unique_name_in_owner

true

libraries

{ &"": SubResource("AnimationLibrary_k41nd") }

young_guy.gd

extends Area2D

signal event

enum State { IDLE, ENTERED, PROGRESS, FINISHED }
var state : State
var entered : bool = false


func _ready() -> void:
	if not owner: start()


func start() -> void:
	state = State.PROGRESS
	%Dialogue.start()


func stop() -> void:
	state = State.ENTERED


func finish() -> void:
	state = State.FINISHED
	%AnimationPlayer.play(&'finish')
	%Speech.visible = false


func _input(event_: InputEvent) -> void:
	if not state == State.ENTERED: return
	if event_.is_action_pressed(&'dialogue_start'):
		start()


func enter(val: bool = true) -> void:
	if val: state = State.ENTERED
	else:   state = State.IDLE
	%ButtonB.visible = val
	%Silence.visible = !val


func exit() -> void:
	enter(false)


func _on_area_entered(_area: Area2D) -> void:
	if not state == State.FINISHED: enter()


func _on_area_exited(_area: Area2D) -> void:
	if not state == State.FINISHED: exit()


func _on_dialogue_paused() -> void:
	stop()


func _on_dialogue_event(event_name: String) -> void:
	if %AnimationPlayer.has_animation(event_name):
		%AnimationPlayer.play(event_name)
	event.emit(event_name)


func _on_dialogue_finished() -> void:
	finish()