44 lines
1.3 KiB
GDScript
44 lines
1.3 KiB
GDScript
class_name QuestView extends Panel
|
|
|
|
const questor_template = preload("res://templates/questor_sprite.tscn")
|
|
|
|
@onready var questorSprite : QuestorSprite
|
|
@onready var setting = $Setting
|
|
var quest : Quest
|
|
@export var base_speed : float
|
|
|
|
func setup(qst : Quest) -> void:
|
|
quest = qst
|
|
quest.questview = self
|
|
questorSprite = questor_template.instantiate()
|
|
questorSprite.setup(quest.questor)
|
|
add_child(questorSprite)
|
|
questorSprite.global_position = $QuestorPosition.global_position
|
|
questorSprite.reset_position = questorSprite.position
|
|
for child in %Layers.get_children():
|
|
if child is Parallax2D:
|
|
child.autoscroll.x = -base_speed * child.scroll_scale.x
|
|
|
|
|
|
func set_questor_animation(anim_name : String) -> void:
|
|
questorSprite.set_animation(anim_name)
|
|
|
|
func set_enemy_animation(enemy : Enemy, anim_name : String) -> void:
|
|
enemy.set_animation(anim_name)
|
|
|
|
func place_enemy(enemy : Enemy, reset : bool = false) -> void:
|
|
add_child(enemy)
|
|
enemy.global_position = $EnemyPosition.global_position
|
|
enemy.reset_position = enemy.position
|
|
|
|
func pause_setting() -> void:
|
|
setting.process_mode = Node.PROCESS_MODE_DISABLED
|
|
|
|
func unpause_setting() -> void:
|
|
setting.process_mode = Node.PROCESS_MODE_INHERIT
|
|
|
|
func show_quest_complete() -> void:
|
|
%QuestComplete.visible = true
|
|
set_questor_animation("idle")
|
|
setting.process_mode = Node.PROCESS_MODE_DISABLED
|