From 5dd4c27430323d1e62fecd11da94a191ba7d9e60 Mon Sep 17 00:00:00 2001 From: Gregory Marco Date: Sat, 17 Oct 2026 17:02:39 -0500 Subject: [PATCH] Proof of concept data disks, pharaoh character --- disk.gd | 7 +++++++ disk.gd.uid | 1 + disk.tscn | 28 ++++++++++++++++++++++++++++ icon.svg.import | 3 --- interactable.gd | 37 +++++++++++++++++++++++++++++++++++++ interactable.gd.uid | 1 + pharaoh.gd | 22 ++++++++++++++++++++++ pharaoh.gd.uid | 1 + pharaoh.tscn | 23 +++++++++++++++++++++++ pickup.gd | 20 ++++++++++++++++++++ pickup.gd.uid | 1 + player_2d.gd | 13 ++++++++++++- project.godot | 21 +++++++++++++++++++++ world.tscn | 16 ++++++++++++++-- 14 files changed, 188 insertions(+), 6 deletions(-) create mode 100644 disk.gd create mode 100644 disk.gd.uid create mode 100644 disk.tscn create mode 100644 interactable.gd create mode 100644 interactable.gd.uid create mode 100644 pharaoh.gd create mode 100644 pharaoh.gd.uid create mode 100644 pharaoh.tscn create mode 100644 pickup.gd create mode 100644 pickup.gd.uid diff --git a/disk.gd b/disk.gd new file mode 100644 index 0000000..13ae1a4 --- /dev/null +++ b/disk.gd @@ -0,0 +1,7 @@ +extends Pickup + +@export var disk_num: int + +func _on_picked_up() -> void: + %Player2D.give_disk(disk_num) + print("Picked up disk ", disk_num) diff --git a/disk.gd.uid b/disk.gd.uid new file mode 100644 index 0000000..84dd604 --- /dev/null +++ b/disk.gd.uid @@ -0,0 +1 @@ +uid://d1uqjaar8v5vi diff --git a/disk.tscn b/disk.tscn new file mode 100644 index 0000000..630d873 --- /dev/null +++ b/disk.tscn @@ -0,0 +1,28 @@ +[gd_scene format=3 uid="uid://b1e1nx60ng3tq"] + +[ext_resource type="Script" uid="uid://d1uqjaar8v5vi" path="res://disk.gd" id="1_olhq3"] +[ext_resource type="Texture2D" uid="uid://b0l3mbvieqbnb" path="res://art/empty_tablet.png" id="3_olhq3"] +[ext_resource type="AudioStream" uid="uid://f2xmq6cgiiwj" path="res://sound/coin.wav" id="4_5qg3x"] + +[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_6qpsl"] +radius = 7.0 +height = 20.0 + +[node name="Disk" type="Node2D" unique_id=1739014101] +script = ExtResource("1_olhq3") + +[node name="Sprite2D" type="Sprite2D" parent="." unique_id=813041394] +texture = ExtResource("3_olhq3") + +[node name="Area2D" type="Area2D" parent="." unique_id=170499029] +scale = Vector2(1.3291091, 1) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D" unique_id=1865546056] +shape = SubResource("CapsuleShape2D_6qpsl") + +[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="." unique_id=1778061188] +stream = ExtResource("4_5qg3x") +volume_db = 1.0 + +[connection signal="picked_up" from="." to="." method="_on_picked_up"] +[connection signal="body_entered" from="Area2D" to="." method="on_contact"] diff --git a/icon.svg.import b/icon.svg.import index ff4a2c7..3ccb140 100644 --- a/icon.svg.import +++ b/icon.svg.import @@ -17,7 +17,6 @@ dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.cte compress/mode=0 compress/high_quality=false -compress/high_quality_mode=0 compress/lossy_quality=0.7 compress/uastc_level=0 compress/rdo_quality_loss=0.0 @@ -26,8 +25,6 @@ compress/normal_map=0 compress/channel_pack=0 mipmaps/generate=false mipmaps/limit=-1 -mipmaps/preserve_alpha_test_coverage=false -mipmaps/alpha_test_threshold=0.5 roughness/mode=0 roughness/src_normal="" process/channel_remap/red=0 diff --git a/interactable.gd b/interactable.gd new file mode 100644 index 0000000..242195d --- /dev/null +++ b/interactable.gd @@ -0,0 +1,37 @@ +class_name Interactable +extends Node2D + +signal interacted + +var checked_teleport +var telecam_speed_mult = 4 +var enabled = true +var cooldown = 2 +var is_interactable = false + +func disable(): + enabled = false + $Sprite2D.modulate = Color.DARK_ORANGE + +func enable(): + enabled = true + $Sprite2D.modulate = Color.WHITE + +func _process(delta: float) -> void: + if not (is_interactable and Input.is_action_just_released("interact")): + return + + interacted.emit() + +func _physics_process(delta: float) -> void: + pass + +func _on_approach(body) -> void: + if body!=%Player2D: + return + is_interactable = true + +func _on_abandon(body) -> void: + if body!=%Player2D: + return + is_interactable = false diff --git a/interactable.gd.uid b/interactable.gd.uid new file mode 100644 index 0000000..eb408d4 --- /dev/null +++ b/interactable.gd.uid @@ -0,0 +1 @@ +uid://dbg7h6gp6hun8 diff --git a/pharaoh.gd b/pharaoh.gd new file mode 100644 index 0000000..9f1ec10 --- /dev/null +++ b/pharaoh.gd @@ -0,0 +1,22 @@ +extends Interactable + +var disks_wanted = [1, 2, 3, 4, 5] +var disks_loaded = [] + +func _ready() -> void: + pass # Replace with function body. + +func load_disk(disk_num: int) -> bool: + if !disk_num or (disk_num in disks_loaded): + return false + + disks_loaded.push_back(disk_num) + disks_wanted.remove_at(disks_wanted.find(disk_num)) + return true + +func _on_interacted() -> void: + var disk_num = %Player2D.take_disk() + if not load_disk(disk_num): + return + + print("Loaded up disk ", disk_num) diff --git a/pharaoh.gd.uid b/pharaoh.gd.uid new file mode 100644 index 0000000..99150e5 --- /dev/null +++ b/pharaoh.gd.uid @@ -0,0 +1 @@ +uid://bh588bpddschq diff --git a/pharaoh.tscn b/pharaoh.tscn new file mode 100644 index 0000000..cc1bfc7 --- /dev/null +++ b/pharaoh.tscn @@ -0,0 +1,23 @@ +[gd_scene format=3 uid="uid://dr8h8xij3qw2h"] + +[ext_resource type="Script" uid="uid://bh588bpddschq" path="res://pharaoh.gd" id="1_mt7kg"] +[ext_resource type="Texture2D" uid="uid://bfqc03jxmymdy" path="res://art/Pharaoh.png" id="2_mt7kg"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_eumkw"] +size = Vector2(26, 32) + +[node name="Pharaoh" type="Node2D" unique_id=1201409437] +script = ExtResource("1_mt7kg") + +[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1680278216] +texture = ExtResource("2_mt7kg") + +[node name="Area2D" type="Area2D" parent="Sprite2D" unique_id=2050186824] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Sprite2D/Area2D" unique_id=1560168165] +position = Vector2(0, -8) +shape = SubResource("RectangleShape2D_eumkw") + +[connection signal="interacted" from="." to="." method="_on_interacted"] +[connection signal="body_entered" from="Sprite2D/Area2D" to="." method="_on_approach"] +[connection signal="body_exited" from="Sprite2D/Area2D" to="." method="_on_abandon"] diff --git a/pickup.gd b/pickup.gd new file mode 100644 index 0000000..4aa34f2 --- /dev/null +++ b/pickup.gd @@ -0,0 +1,20 @@ +class_name Pickup +extends Node2D + +signal picked_up + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + pass # Replace with function body. + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + pass + +func on_contact(body: Node2D) -> void: + print(body) + $AudioStreamPlayer2D.play(0) + visible = false + picked_up.emit() + await get_tree().create_timer(0.2).timeout + queue_free() diff --git a/pickup.gd.uid b/pickup.gd.uid new file mode 100644 index 0000000..3301f53 --- /dev/null +++ b/pickup.gd.uid @@ -0,0 +1 @@ +uid://bun3ype8fkpv8 diff --git a/player_2d.gd b/player_2d.gd index c2bf67a..b75152d 100644 --- a/player_2d.gd +++ b/player_2d.gd @@ -18,6 +18,8 @@ var dashing = false var death_threshold = 1000 var coins = 0 +var data_disks = [] + func _ready() -> void: DisplayServer.window_set_title("JUMPS EQUALS JUMPS") @@ -32,7 +34,16 @@ func refresh_jump(new_jumps): jumps = new_jumps else: jumps = 1 - + +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 on_teleport(): refresh_jump(1) teleport_cooldown = 1 diff --git a/project.godot b/project.godot index 77305f7..fec94bd 100644 --- a/project.godot +++ b/project.godot @@ -360,6 +360,27 @@ controller_restart_right={ "script": null )] } +interact={ +"deadzone": 0.2, +"events": [Object(InputEventKey, +"resource_local_to_scene": false, +"resource_name": "", +"device": -1, +"window_id": 0, +"alt_pressed": false, +"shift_pressed": false, +"ctrl_pressed": false, +"meta_pressed": false, +"pressed": false, +"keycode": 0, +"physical_keycode": 69, +"key_label": 0, +"unicode": 101, +"location": 0, +"echo": false, +"script": null +)] +} [input_devices] diff --git a/world.tscn b/world.tscn index 4a8a5d0..48938ab 100644 --- a/world.tscn +++ b/world.tscn @@ -10,10 +10,12 @@ [ext_resource type="PackedScene" uid="uid://bos6oh7nwyeca" path="res://vertical_long_block.tscn" id="4_pkg7o"] [ext_resource type="PackedScene" uid="uid://biot4cuwgohvo" path="res://longer_block.tscn" id="6_dwbse"] [ext_resource type="PackedScene" uid="uid://kstmxoa4dx55" path="res://coin.tscn" id="8_ioo17"] +[ext_resource type="PackedScene" uid="uid://b1e1nx60ng3tq" path="res://disk.tscn" id="10_2u3nc"] [ext_resource type="Texture2D" uid="uid://s3h6tpypoee0" path="res://art/music_button.png" id="12_2o6r5"] [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="PackedScene" uid="uid://dr8h8xij3qw2h" path="res://pharaoh.tscn" id="15_hiqwa"] [node name="World" type="Node2D" unique_id=1327991900] process_mode = 3 @@ -144,6 +146,10 @@ position = Vector2(0, -58.094738) [node name="Coin4" parent="Tutorial" unique_id=1504473184 instance=ExtResource("8_ioo17")] position = Vector2(0, -85.66513) +[node name="Disk" parent="Tutorial" unique_id=514380026 instance=ExtResource("10_2u3nc")] +position = Vector2(213, 95.511696) +disk_num = 1 + [node name="ZoeLevel" type="Node2D" parent="." unique_id=980267417] [node name="LongBlock4" parent="ZoeLevel" unique_id=469408536 instance=ExtResource("6_dwbse")] @@ -180,8 +186,10 @@ script = ExtResource("2_dwbse") anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 -offset_top = 23.0 -offset_bottom = 23.0 +offset_left = 3.0 +offset_top = 32.0 +offset_right = 3.0 +offset_bottom = 32.0 grow_horizontal = 2 grow_vertical = 2 bbcode_enabled = true @@ -208,4 +216,8 @@ texture_pressed = ExtResource("13_70uel") texture_disabled = ExtResource("13_70uel") script = ExtResource("14_70uel") +[node name="Pharaoh" parent="." unique_id=44054531 instance=ExtResource("15_hiqwa")] +unique_name_in_owner = true +position = Vector2(192, 185.11545) + [connection signal="toggled" from="CanvasLayer/MusicButton" to="CanvasLayer/MusicButton" method="_on_toggled"]