src / dialogue / chapters / 1 / young_guy / young_guy.tscn
Diagram
Overridden virtual functions
_ready
func _ready() -> void:
if not owner: start()
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()
func _input(_event: InputEvent) -> void:
if not started: return
if waiting: return
if _event.is_action_pressed('ui_accept'):
continue_dialogue()
Scene Tree
-
YoungGuy Area2D
-
Dialogue res://src/dialogue/dialogue.tscn
-
YoungGuy res://src/stages/1/scenary/young_guy/young_guy.tscn
-
Speech Sprite2D
-
ButtonB Sprite2D
-
Silence Sprite2D
-
-
-
Tent Sprite2D
-
CollisionShape2D CollisionShape2D
-
Camera2D Camera2D
-
AnimationPlayer AnimationPlayer
-
Signal Connections
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_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()
func _on_dialogue_paused() -> void:
stop()
Animations
01.zoom
Animation_k41nd
finish
Properties
| Name | Value |
|---|---|
collision_layer |
|
collision_mask |
|
script |
| Name | Value |
|---|---|
unique_name_in_owner |
|
visible |
|
boot_file |
|
speakers |
|
| Name | Value |
|---|---|
position |
|
| Name | Value |
|---|---|
unique_name_in_owner |
|
position |
|
scale |
|
texture |
| Name | Value |
|---|---|
unique_name_in_owner |
|
visible |
|
position |
|
scale |
|
texture |
| Name | Value |
|---|---|
unique_name_in_owner |
|
texture |
| Name | Value |
|---|---|
light_mask |
|
position |
|
| Name | Value |
|---|---|
position |
|
scale |
|
texture |
| Name | Value |
|---|---|
position |
|
shape |
|
| Name | Value |
|---|---|
position |
|
enabled |
|
| Name | Value |
|---|---|
unique_name_in_owner |
|
libraries |
|
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()


