From 8294ff065531da0e7ad42865a7473031ea62fbaa Mon Sep 17 00:00:00 2001 From: tonydero Date: Fri, 18 Oct 2024 14:05:31 -0600 Subject: [PATCH] switch to quest instantiation --- scenes/quest.tscn | 6 +-- scenes/testScrollScene.tscn | 82 +++++++++++++++++++++++++++++++++--- scripts/test_scroll_scene.gd | 7 +++ 3 files changed, 84 insertions(+), 11 deletions(-) diff --git a/scenes/quest.tscn b/scenes/quest.tscn index 17028de..a98f3fa 100644 --- a/scenes/quest.tscn +++ b/scenes/quest.tscn @@ -16,11 +16,7 @@ layout_mode = 2 [node name="GoalTypeVal" type="Label" parent="QuestProgress"] layout_mode = 2 -text = "Quest Objective" - -[node name="KillTypeVal" type="Label" parent="QuestProgress"] -layout_mode = 2 -text = "Quest Objective" +text = "Kill" [node name="Colon" type="Label" parent="QuestProgress"] layout_mode = 2 diff --git a/scenes/testScrollScene.tscn b/scenes/testScrollScene.tscn index e575f39..fb2272f 100644 --- a/scenes/testScrollScene.tscn +++ b/scenes/testScrollScene.tscn @@ -1,9 +1,8 @@ -[gd_scene load_steps=10 format=3 uid="uid://0h3dpe6fuhe8"] +[gd_scene load_steps=15 format=3 uid="uid://0h3dpe6fuhe8"] [ext_resource type="Script" path="res://scripts/test_scroll_scene.gd" id="1_gc1kb"] [ext_resource type="Theme" uid="uid://clhh3c3gxotjg" path="res://assets/healthbar.tres" id="2_2v2l0"] [ext_resource type="Script" path="res://scripts/WorldArea.gd" id="2_ccxbh"] -[ext_resource type="PackedScene" uid="uid://klcyjys703l5" path="res://scenes/quest.tscn" id="2_dodxo"] [ext_resource type="PackedScene" uid="uid://dvwo26vsk46tl" path="res://scenes/ability_ph.tscn" id="2_heria"] [ext_resource type="Theme" uid="uid://cp82s71sduhcv" path="res://assets/expbar.tres" id="3_n8q4b"] @@ -11,6 +10,27 @@ [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_imvmd"] +[sub_resource type="Curve" id="Curve_lpwpb"] +_data = [Vector2(0.497076, 0.724988), 0.0, 0.0, 0, 0] +point_count = 1 + +[sub_resource type="CurveTexture" id="CurveTexture_mtsg5"] +texture_mode = 1 +curve = SubResource("Curve_lpwpb") + +[sub_resource type="Curve" id="Curve_j1e3e"] +_data = [Vector2(0.5, 0.236436), 0.0, 0.0, 0, 0] +point_count = 1 + +[sub_resource type="Curve" id="Curve_0hsoj"] + +[sub_resource type="Curve" id="Curve_wmq0q"] + +[sub_resource type="CurveXYZTexture" id="CurveXYZTexture_m13yr"] +curve_x = SubResource("Curve_j1e3e") +curve_y = SubResource("Curve_0hsoj") +curve_z = SubResource("Curve_wmq0q") + [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_6jnvr"] [node name="TestInstanceScene" type="Control"] @@ -57,10 +77,6 @@ unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 4 -[node name="PHQuest" parent="MarginContainer/UITop/QuestsContainer" instance=ExtResource("2_dodxo")] -layout_mode = 2 -goalTotal = 20 - [node name="UIBottom" type="HBoxContainer" parent="MarginContainer"] layout_mode = 2 size_flags_vertical = 8 @@ -86,6 +102,7 @@ layout_mode = 2 text = "Player" [node name="PlayerHealthBar" type="ProgressBar" parent="MarginContainer/UIBottom/PlayerContainer/PlayerInfo"] +visible = false custom_minimum_size = Vector2(0, 32) layout_mode = 2 size_flags_vertical = 2 @@ -93,6 +110,59 @@ theme = ExtResource("2_2v2l0") step = 1.0 value = 100.0 +[node name="PlayerHealthTextureBar" type="TextureProgressBar" parent="MarginContainer/UIBottom/PlayerContainer/PlayerInfo"] +custom_minimum_size = Vector2(0, 32) +layout_mode = 2 +size_flags_vertical = 2 +theme = ExtResource("2_2v2l0") +value = 72.0 +nine_patch_stretch = true +texture_under = SubResource("CurveTexture_mtsg5") +texture_progress = SubResource("CurveXYZTexture_m13yr") + +[node name="PlayerHealthCurrent" type="Label" parent="MarginContainer/UIBottom/PlayerContainer/PlayerInfo/PlayerHealthTextureBar"] +layout_mode = 1 +anchors_preset = -1 +anchor_left = 0.0216216 +anchor_top = 0.15625 +anchor_right = 0.286486 +anchor_bottom = 0.875 +grow_vertical = 2 +text = "0" +vertical_alignment = 1 +metadata/_edit_use_anchors_ = true + +[node name="PlayerHealthTotal" type="Label" parent="MarginContainer/UIBottom/PlayerContainer/PlayerInfo/PlayerHealthTextureBar"] +layout_mode = 1 +anchors_preset = -1 +anchor_left = 0.708108 +anchor_top = 0.15625 +anchor_right = 0.978378 +anchor_bottom = 0.8125 +grow_horizontal = 0 +grow_vertical = 2 +text = "0" +horizontal_alignment = 2 +vertical_alignment = 1 +metadata/_edit_use_anchors_ = true + +[node name="PlayerHealthPercent" type="Label" parent="MarginContainer/UIBottom/PlayerContainer/PlayerInfo/PlayerHealthTextureBar"] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -3.0 +offset_top = -7.0 +offset_right = 3.0 +offset_bottom = 7.0 +grow_horizontal = 2 +grow_vertical = 2 +text = "0" +horizontal_alignment = 1 +vertical_alignment = 1 + [node name="PlayerExpBar" type="ProgressBar" parent="MarginContainer/UIBottom/PlayerContainer/PlayerInfo"] layout_mode = 2 size_flags_vertical = 10 diff --git a/scripts/test_scroll_scene.gd b/scripts/test_scroll_scene.gd index 2e1a442..7d1a461 100644 --- a/scripts/test_scroll_scene.gd +++ b/scripts/test_scroll_scene.gd @@ -19,6 +19,8 @@ func _ready() -> void: Engine.time_scale = 3.0 SignalBus.quest_completed.connect(_on_quest_completed) + + _generate_quest() middleX = get_viewport_rect().size.x / 2 playerPos = Vector2(middleX, get_viewport_rect().size.y * (0.75)) @@ -34,6 +36,11 @@ func _process(_delta: float) -> void: if _get_enemies().is_empty() and questComplete: print("Area Complete!") get_tree().quit() + + +func _generate_quest() -> void: + var quest = load("res://scenes/quest.tscn").instantiate() + %QuestsContainer.add_child(quest) func _create_enemy():