From 1aa29a0539a6c0dbcf381b2cd14c2c0a461a6ae8 Mon Sep 17 00:00:00 2001 From: Gregory Marco Date: Sat, 17 Oct 2026 18:04:18 -0500 Subject: [PATCH] Add objectives listing and all four data disks/tablets. Track each individual disk and ensure they are loaded in order. Player can collect multiple disks in one run but must present them to the pharaoh in order. --- disk.gd | 1 + objectives_label.gd | 8 ++++++++ objectives_label.gd.uid | 1 + pharaoh.gd | 18 ++++++++++++++---- player_2d.gd | 26 ++++++++++++++++++++------ player_2d.tscn | 8 ++++---- world.tscn | 25 +++++++++++++++++++++++++ 7 files changed, 73 insertions(+), 14 deletions(-) create mode 100644 objectives_label.gd create mode 100644 objectives_label.gd.uid diff --git a/disk.gd b/disk.gd index 13ae1a4..b45da36 100644 --- a/disk.gd +++ b/disk.gd @@ -4,4 +4,5 @@ extends Pickup func _on_picked_up() -> void: %Player2D.give_disk(disk_num) + %Player2D.give_objective("disk%d" % disk_num, "Install data disk %d" % disk_num) print("Picked up disk ", disk_num) diff --git a/objectives_label.gd b/objectives_label.gd new file mode 100644 index 0000000..7f88101 --- /dev/null +++ b/objectives_label.gd @@ -0,0 +1,8 @@ +extends RichTextLabel + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + var new_text = "OBJECTIVES:\n" + for objective in %Player2D.objectives: + new_text = new_text + %Player2D.objectives[objective] + text = new_text diff --git a/objectives_label.gd.uid b/objectives_label.gd.uid new file mode 100644 index 0000000..8afb70c --- /dev/null +++ b/objectives_label.gd.uid @@ -0,0 +1 @@ +uid://oyyhhy1gemg0 diff --git a/pharaoh.gd b/pharaoh.gd index 9f1ec10..ed550fc 100644 --- a/pharaoh.gd +++ b/pharaoh.gd @@ -1,6 +1,6 @@ extends Interactable -var disks_wanted = [1, 2, 3, 4, 5] +var disks_wanted = [1, 2, 3, 4] var disks_loaded = [] func _ready() -> void: @@ -15,8 +15,18 @@ func load_disk(disk_num: int) -> bool: return true func _on_interacted() -> void: - var disk_num = %Player2D.take_disk() - if not load_disk(disk_num): + var wanted_disk = disks_wanted.front() + if not %Player2D.take_disk(wanted_disk): return - print("Loaded up disk ", disk_num) + if not load_disk(wanted_disk): + return + + %Player2D.complete_objective("disk%d" % wanted_disk) + print("Loaded up disk ", wanted_disk) + + wanted_disk = disks_wanted.front() + if not wanted_disk: + return + + %Player2D.give_objective("disk%d" % wanted_disk, "Locate data disk %d" % wanted_disk) diff --git a/player_2d.gd b/player_2d.gd index bcffccb..07b6818 100644 --- a/player_2d.gd +++ b/player_2d.gd @@ -19,6 +19,7 @@ var death_threshold = 1000 var coins = 0 var data_disks = [] +var objectives = {} func _ready() -> void: DisplayServer.window_set_title("JUMPS EQUALS JUMPS") @@ -43,12 +44,25 @@ func refresh_jump(new_jumps): func give_disk(disk_num: int) -> void: data_disks.push_back(disk_num) -func take_disk() -> int: - var disk_num = data_disks.pop_back() - if disk_num: - return disk_num - return 0 - +func take_disk(disk_num) -> bool: + if not has_disk(disk_num): + return false + + data_disks.remove_at(data_disks.find(disk_num)) + return true + +func has_disk(disk_num: int) -> bool: + return disk_num in data_disks + +func give_objective(id: String, description: String) -> void: + objectives[id] = description + +func has_objective(id: String) -> bool: + return objectives.has(id) + +func complete_objective(id: String) -> bool: + return objectives.erase(id) + func on_teleport(): refresh_jump(1) teleport_cooldown = 1 diff --git a/player_2d.tscn b/player_2d.tscn index dd78eaf..867bfca 100644 --- a/player_2d.tscn +++ b/player_2d.tscn @@ -5,8 +5,8 @@ [ext_resource type="Texture2D" uid="uid://dpdxs6gjmexgh" path="res://art/background.png" id="3_p3026"] [ext_resource type="Texture2D" uid="uid://biv3f67rqumak" path="res://art/level_start.png" id="4_nj6as"] [ext_resource type="Script" uid="uid://3bqq3mfbby2c" path="res://warp_shader.gd" id="4_pmt5n"] -[ext_resource type="Texture2D" uid="uid://lk0f1qyswyxv" path="res://art/player/running/frame1.png" id="5_6jyqn"] -[ext_resource type="Texture2D" uid="uid://lmje8plw76e1" path="res://art/player/running/frame2.png" id="6_gt2ls"] +[ext_resource type="Texture2D" uid="uid://lk0f1qyswyxv" path="res://art/player/idle/frame1.png" id="5_6jyqn"] +[ext_resource type="Texture2D" uid="uid://lmje8plw76e1" path="res://art/player/idle/frame2.png" id="6_gt2ls"] [ext_resource type="Texture2D" uid="uid://bfyd1tro3s0gl" path="res://art/player/crystal2.png" id="7_oy4pt"] [ext_resource type="Texture2D" uid="uid://dh7a1knyqn5nd" path="res://art/player/running/frame3.png" id="7_pmt5n"] [ext_resource type="Texture2D" uid="uid://yf13nw31k8ua" path="res://art/player/running/frame4.png" id="8_nj6as"] @@ -161,7 +161,7 @@ autoplay = "idle" [node name="DashIndicator" type="CPUParticles2D" parent="Jetpack" unique_id=1424397604] position = Vector2(-11, -2) texture = ExtResource("16_ur4nw") -lifetime = 0.09999999999999999 +lifetime = 0.1 gravity = Vector2(0, 0) [node name="DashIndicatorGlow" type="PointLight2D" parent="Jetpack/DashIndicator" unique_id=1334369973] @@ -172,7 +172,7 @@ texture = ExtResource("10_ur4nw") [node name="JumpIndicator" type="CPUParticles2D" parent="Jetpack" unique_id=1519478958] position = Vector2(13, -2) texture = ExtResource("18_fat58") -lifetime = 0.09999999999999999 +lifetime = 0.1 gravity = Vector2(0, 0) [node name="JumpIndicatorGlow" type="PointLight2D" parent="Jetpack/JumpIndicator" unique_id=920409859] diff --git a/world.tscn b/world.tscn index ebe5d7d..b7c13de 100644 --- a/world.tscn +++ b/world.tscn @@ -16,6 +16,7 @@ [ext_resource type="PackedScene" uid="uid://c8m4d77hcr0pj" path="res://spike.tscn" id="12_k3n1d"] [ext_resource type="Texture2D" uid="uid://dxgnkftqtyt53" path="res://art/music_button_disabled.png" id="13_70uel"] [ext_resource type="Script" uid="uid://d3rx82psovcpp" path="res://music_button.gd" id="14_70uel"] +[ext_resource type="Script" uid="uid://oyyhhy1gemg0" path="res://objectives_label.gd" id="14_ikiii"] [ext_resource type="PackedScene" uid="uid://dr8h8xij3qw2h" path="res://pharaoh.tscn" id="15_hiqwa"] [node name="World" type="Node2D" unique_id=1327991900] @@ -205,6 +206,18 @@ position = Vector2(0, -85.66513) position = Vector2(213, 95.511696) disk_num = 1 +[node name="Disk2" parent="Tutorial" unique_id=369042906 instance=ExtResource("10_2u3nc")] +position = Vector2(285, 96.49635) +disk_num = 2 + +[node name="Disk3" parent="Tutorial" unique_id=224370384 instance=ExtResource("10_2u3nc")] +position = Vector2(188, 234.34827) +disk_num = 3 + +[node name="Disk4" parent="Tutorial" unique_id=1193788903 instance=ExtResource("10_2u3nc")] +position = Vector2(293, 182.16148) +disk_num = 4 + [node name="WallSpike" parent="Tutorial" unique_id=287086441 instance=ExtResource("10_hiqwa")] position = Vector2(1325, 629.1956) @@ -310,6 +323,18 @@ bbcode_enabled = true text = "COINS:" script = ExtResource("3_wse8f") +[node name="Objectives" type="RichTextLabel" parent="CanvasLayer" unique_id=528356873] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_top = 274.0 +offset_bottom = 274.0 +grow_horizontal = 2 +grow_vertical = 2 +bbcode_enabled = true +text = "OBJECTIVES:" +script = ExtResource("14_ikiii") + [node name="MusicButton" type="TextureButton" parent="CanvasLayer" unique_id=1088022504] unique_name_in_owner = true anchors_preset = 1