From c9510f8902b47d04d16f0378a3eb5bc31b154c4d Mon Sep 17 00:00:00 2001 From: debugman18 Date: Sun, 18 Oct 2026 00:28:27 -0500 Subject: [PATCH] Some tutorial --- art/block/portal.png | Bin 444 -> 449 bytes art/block/portal2.png | Bin 439 -> 449 bytes art/block/portal3.png | Bin 445 -> 454 bytes block.tscn | 2 +- down_spike.tscn | 24 ++++++++++++++++++++++++ long_floor_spike.gd | 14 ++++++++++++++ long_floor_spike.gd.uid | 1 + long_floor_spike.tscn | 32 ++++++++++++++++++++++++++++++++ pharaoh.gd | 3 ++- pharaoh.tscn | 2 +- player_2d.gd | 7 +++++-- player_2d.tscn | 10 +++++++--- spike.gd | 3 +-- spike.tscn | 4 ++-- vertical_block.tscn | 18 ++++++++++++++++++ world.tscn | 36 ++++++++++++++++++++++++++---------- 16 files changed, 134 insertions(+), 22 deletions(-) create mode 100644 down_spike.tscn create mode 100644 long_floor_spike.gd create mode 100644 long_floor_spike.gd.uid create mode 100644 long_floor_spike.tscn create mode 100644 vertical_block.tscn diff --git a/art/block/portal.png b/art/block/portal.png index 838a5865af29bc983637ce63d7ac62610d49b06d..a4a1f2d1e3cd2da2cd4e589f7b5827be00a0143a 100644 GIT binary patch delta 139 zcmdnPe2{s9qatU3Pl#(uO3MHL{}~tZlBxfm1#n7016w<_UZqB3pHH?HS`T2b7m%(NU%ySU4BF~%e`ee}7oeiu){dG*D| rbNVAymN#s@ArfF0-haMUp_H-Nmf?@`jOdR*TNpfD{an^LB{Ts5zJ4>L delta 134 zcmV;10D1qx1H1!}K^+EAOjJc=WMlvU0PgffS^xk50(4SNQ~vmw(Cy0ssI207*qoM6N<$f`#%iY5)KL diff --git a/art/block/portal2.png b/art/block/portal2.png index 0ccfb91b98504cd9d7b3e3864f6e8679cec5a285..49256854e0986968fca5999d03654cee6384d8f3 100644 GIT binary patch delta 139 zcmdnae2{s9qatU3Pl#(uO3MHL{}~tZkg`4|*9oHqWJ-_@8A_Gd-Dh2U$!m?iuL0v%I07_Avpn6}MsDApC}5Rf|X?PbP| r2m2=dtK8OPnaTe0#pCT&?=qM>Co}xJwK`U(gN%d;cZ*;3(5`=z8>5FUqBj= ykOjmnfb3)sL6fXM(aYaoIR p^W+d{!XP_2fLkg%2^;lsj}B6Z0GHzrevJSC002ovPDHLkV1o5(F~k4> diff --git a/block.tscn b/block.tscn index 1e60c7d..105bc16 100644 --- a/block.tscn +++ b/block.tscn @@ -3,7 +3,7 @@ [ext_resource type="Texture2D" uid="uid://blbaaqyrt8dtk" path="res://art/block/block.png" id="1_im0tn"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_f3sb7"] -size = Vector2(16, 16) +size = Vector2(16, 14) [node name="Block" type="RigidBody2D" unique_id=1409784601] gravity_scale = 0.0 diff --git a/down_spike.tscn b/down_spike.tscn new file mode 100644 index 0000000..9d940d6 --- /dev/null +++ b/down_spike.tscn @@ -0,0 +1,24 @@ +[gd_scene format=3 uid="uid://hqmkjtv5shyk"] + +[ext_resource type="Script" uid="uid://brlrpnqrsi2vn" path="res://spike.gd" id="1_bl7j6"] +[ext_resource type="Texture2D" uid="uid://bu5wgerfu7cbc" path="res://art/spike.png" id="2_24rqj"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_xfwl5"] +size = Vector2(15, 10) + +[node name="Spike" type="Node2D" unique_id=1739014101] +script = ExtResource("1_bl7j6") + +[node name="Sprite2D" type="Sprite2D" parent="." unique_id=813041394] +texture_filter = 1 +position = Vector2(0, 2) +scale = Vector2(-1, -1) +texture = ExtResource("2_24rqj") + +[node name="Area2D" type="Area2D" parent="." unique_id=170499029] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D" unique_id=1865546056] +position = Vector2(-0.5, -1) +shape = SubResource("RectangleShape2D_xfwl5") + +[connection signal="body_entered" from="Area2D" to="." method="on_contact"] diff --git a/long_floor_spike.gd b/long_floor_spike.gd new file mode 100644 index 0000000..ca85932 --- /dev/null +++ b/long_floor_spike.gd @@ -0,0 +1,14 @@ +extends Node2D + +func _ready() -> void: + pass + +func _process(delta: float) -> void: + pass + +func on_contact(body: Node2D) -> void: + if body==%Player2D and %Player2D.death_cooldown == 0: + print("SLASH KILL") + %Player2D/Jetpack/DeathSound.play() + %Player2D.on_death(false,%Player2D.position) + print(body) diff --git a/long_floor_spike.gd.uid b/long_floor_spike.gd.uid new file mode 100644 index 0000000..e762843 --- /dev/null +++ b/long_floor_spike.gd.uid @@ -0,0 +1 @@ +uid://cvguf2l65n7xa diff --git a/long_floor_spike.tscn b/long_floor_spike.tscn new file mode 100644 index 0000000..494dfcf --- /dev/null +++ b/long_floor_spike.tscn @@ -0,0 +1,32 @@ +[gd_scene format=3 uid="uid://b1ccvtwwb1cl7"] + +[ext_resource type="PackedScene" uid="uid://c8m4d77hcr0pj" path="res://spike.tscn" id="1_phdmj"] +[ext_resource type="Script" uid="uid://cvguf2l65n7xa" path="res://long_floor_spike.gd" id="1_rwckv"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_phdmj"] +size = Vector2(74, 9) + +[node name="Spike" type="Node2D" unique_id=1739014101] +script = ExtResource("1_rwckv") + +[node name="Spike" parent="." unique_id=324768327 instance=ExtResource("1_phdmj")] + +[node name="Spike2" parent="." unique_id=1119131696 instance=ExtResource("1_phdmj")] +position = Vector2(15, 0) + +[node name="Spike5" parent="." unique_id=356301870 instance=ExtResource("1_phdmj")] +position = Vector2(30, 0) + +[node name="Spike3" parent="." unique_id=1414181030 instance=ExtResource("1_phdmj")] +position = Vector2(-15, 0) + +[node name="Spike4" parent="." unique_id=333001001 instance=ExtResource("1_phdmj")] +position = Vector2(-30, 0) + +[node name="Area2D" type="Area2D" parent="." unique_id=2124972792] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D" unique_id=371031870] +position = Vector2(0, 5.5) +shape = SubResource("RectangleShape2D_phdmj") + +[connection signal="body_entered" from="Area2D" to="." method="on_contact"] diff --git a/pharaoh.gd b/pharaoh.gd index d0a87fe..4c6f8d7 100644 --- a/pharaoh.gd +++ b/pharaoh.gd @@ -22,7 +22,8 @@ func _on_interacted() -> void: var wanted_disk = disks_wanted.front() - %Player2D.spawn_point = global_position + #Accomodate some collision antics. + %Player2D.spawn_point = global_position + Vector2(0,-10) if not %Player2D.take_disk(wanted_disk): if wanted_disk == 1 and not %Player2D.has_objective("disk%d" % wanted_disk): diff --git a/pharaoh.tscn b/pharaoh.tscn index 0b9ec3e..38a759d 100644 --- a/pharaoh.tscn +++ b/pharaoh.tscn @@ -11,7 +11,7 @@ size = Vector2(26, 32) script = ExtResource("1_mt7kg") [node name="Sprite2D" type="Sprite2D" parent="." unique_id=1680278216] -position = Vector2(0, -15) +position = Vector2(0, -16) texture = ExtResource("2_mt7kg") [node name="Area2D" type="Area2D" parent="Sprite2D" unique_id=2050186824] diff --git a/player_2d.gd b/player_2d.gd index 2f595b3..4a2bf5b 100644 --- a/player_2d.gd +++ b/player_2d.gd @@ -7,8 +7,9 @@ const FRICTION = 100 const GRAVITY_MULT = 0.8 const JUMP_VELOCITY = -410.0 const DASH_LENGTH = 0.2 -const BACKGROUND_COLOR = Color.SANDY_BROWN +const BACKGROUND_COLOR = Color.INDIAN_RED +var death_cooldown = 0.0 var fall_timer = 0.0 var teleport_cooldown = 0 var jumps = 0 @@ -91,6 +92,7 @@ func spawn_ghost(ghost_position): ghost.position = ghost_position func on_death(instant = false, player_position = position): + death_cooldown += 1 if !instant: await get_tree().create_timer(0.1).timeout get_tree().paused = true @@ -108,6 +110,8 @@ func on_death(instant = false, player_position = position): #position = %LevelStart.position position = spawn_point + await get_tree().create_timer(0.1).timeout + death_cooldown = 0 func _process(delta: float) -> void: if Input.is_action_just_released("restart") or (Input.is_action_pressed("controller_restart_left") and Input.is_action_pressed("controller_restart_right")): @@ -208,7 +212,6 @@ func _process(delta: float) -> void: #get_tree().reload_current_scene() func _physics_process(delta: float) -> void: - if not is_on_floor(): velocity += (get_gravity() * GRAVITY_MULT) * delta diff --git a/player_2d.tscn b/player_2d.tscn index abcefe7..a1ca4c2 100644 --- a/player_2d.tscn +++ b/player_2d.tscn @@ -124,10 +124,12 @@ animations = [{ "speed": 5.0 }] -[sub_resource type="RectangleShape2D" id="RectangleShape2D_fj7yv"] -size = Vector2(10, 16) +[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_ix7pg"] +radius = 6.0 +height = 12.0 [node name="Player2D" type="CharacterBody2D" unique_id=889851478] +safe_margin = 0.06 script = ExtResource("1_sy00s") [node name="BackgroundMusic" type="AudioStreamPlayer2D" parent="." unique_id=299359239] @@ -139,6 +141,7 @@ script = ExtResource("3_sxtm6") [node name="WarpShader" type="MeshInstance2D" parent="CanvasLayer2" unique_id=88397728] material = SubResource("ShaderMaterial_pmt5n") +position = Vector2(0, -1) mesh = SubResource("QuadMesh_nj6as") script = ExtResource("4_pmt5n") @@ -220,4 +223,5 @@ stream = ExtResource("20_l50qk") stream = ExtResource("20_1741q") [node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1294571021] -shape = SubResource("RectangleShape2D_fj7yv") +position = Vector2(0, 3) +shape = SubResource("CapsuleShape2D_ix7pg") diff --git a/spike.gd b/spike.gd index 52ed27b..ca85932 100644 --- a/spike.gd +++ b/spike.gd @@ -7,9 +7,8 @@ func _process(delta: float) -> void: pass func on_contact(body: Node2D) -> void: - if body==%Player2D: + if body==%Player2D and %Player2D.death_cooldown == 0: print("SLASH KILL") %Player2D/Jetpack/DeathSound.play() %Player2D.on_death(false,%Player2D.position) print(body) - diff --git a/spike.tscn b/spike.tscn index 6427201..0cf51b5 100644 --- a/spike.tscn +++ b/spike.tscn @@ -4,7 +4,7 @@ [ext_resource type="Texture2D" uid="uid://bu5wgerfu7cbc" path="res://art/spike.png" id="2_7k7bx"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_xfwl5"] -size = Vector2(15, 12) +size = Vector2(15, 7.5) [node name="Spike" type="Node2D" unique_id=1739014101] script = ExtResource("1_7k7bx") @@ -17,7 +17,7 @@ texture = ExtResource("2_7k7bx") [node name="Area2D" type="Area2D" parent="." unique_id=170499029] [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D" unique_id=1865546056] -position = Vector2(-0.5, 0) +position = Vector2(0, 4.75) shape = SubResource("RectangleShape2D_xfwl5") [connection signal="body_entered" from="Area2D" to="." method="on_contact"] diff --git a/vertical_block.tscn b/vertical_block.tscn new file mode 100644 index 0000000..2502e51 --- /dev/null +++ b/vertical_block.tscn @@ -0,0 +1,18 @@ +[gd_scene format=3 uid="uid://byfgwmvln8ukh"] + +[ext_resource type="Texture2D" uid="uid://blbaaqyrt8dtk" path="res://art/block/block.png" id="1_j20nc"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_f3sb7"] +size = Vector2(16, 16) + +[node name="Block" type="RigidBody2D" unique_id=1409784601] +gravity_scale = 0.0 +freeze = true + +[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1866755047] +shape = SubResource("RectangleShape2D_f3sb7") + +[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1680278216] +texture_filter = 1 +rotation = 1.5707964 +texture = ExtResource("1_j20nc") diff --git a/world.tscn b/world.tscn index fe6ddd2..8f817b0 100644 --- a/world.tscn +++ b/world.tscn @@ -26,24 +26,36 @@ scale = Vector2(1, 1.0155824) [node name="Player2D" parent="." unique_id=889851478 instance=ExtResource("1_aqk2v")] unique_name_in_owner = true -position = Vector2(-1004, -1335.1945) +position = Vector2(-4844.9995, 356.44568) +rotation = 0.0005533503 [node name="StartingArea" type="Node2D" parent="." unique_id=130240736] -position = Vector2(-842, -1300.7314) +position = Vector2(-4673, 390.9087) -[node name="LongerBlock" parent="StartingArea" unique_id=426800863 instance=ExtResource("6_dwbse")] +[node name="LongerBlock" parent="StartingArea" unique_id=1619185575 instance=ExtResource("6_dwbse")] position = Vector2(-17, -17.72377) -[node name="LongerBlock3" parent="StartingArea" unique_id=1122236775 instance=ExtResource("6_dwbse")] -position = Vector2(-193, -179.20744) -rotation = 1.5707964 +[node name="LongerBlock2" parent="StartingArea" unique_id=426800863 instance=ExtResource("6_dwbse")] +position = Vector2(650, -17.72377) -[node name="LongerBlock2" parent="StartingArea" unique_id=75325542 instance=ExtResource("6_dwbse")] -position = Vector2(-17, -79.75723) +[node name="LongerBlock5" parent="StartingArea" unique_id=1844119708 instance=ExtResource("6_dwbse")] +position = Vector2(1657, -18.708487) + +[node name="LongerBlock7" parent="StartingArea" unique_id=2057011049 instance=ExtResource("6_dwbse")] +position = Vector2(2901, -19.693142) [node name="Pharaoh" parent="StartingArea" unique_id=1201409437 instance=ExtResource("15_hiqwa")] position = Vector2(-62, -24.616333) +[node name="Pharaoh2" parent="StartingArea" unique_id=472779826 instance=ExtResource("15_hiqwa")] +position = Vector2(615, -24.616425) + +[node name="Pharaoh3" parent="StartingArea" unique_id=1148075738 instance=ExtResource("15_hiqwa")] +position = Vector2(1609, -26.585724) + +[node name="Pharaoh4" parent="StartingArea" unique_id=764966940 instance=ExtResource("15_hiqwa")] +position = Vector2(2808, -27.570404) + [node name="Tutorial" type="Node2D" parent="." unique_id=1391494772] [node name="Block2" parent="Tutorial" unique_id=878186522 instance=ExtResource("2_036b0")] @@ -436,11 +448,12 @@ script = ExtResource("14_70uel") [node name="Pharaoh" parent="." unique_id=44054531 instance=ExtResource("15_hiqwa")] unique_name_in_owner = true -position = Vector2(192, 177.23824) +position = Vector2(55, 111.266205) +rotation = 4.9367074e-05 [node name="Pharaoh2" parent="." unique_id=1541178727 instance=ExtResource("15_hiqwa")] unique_name_in_owner = true -position = Vector2(6338, -58.09474) +position = Vector2(6338, -42.34024) [node name="OldComputer" parent="." unique_id=1951254108 instance=ExtResource("19_cbp6q")] unique_name_in_owner = true @@ -496,4 +509,7 @@ position = Vector2(7732, -109.12882) [node name="VerticalLongBlock6" parent="." unique_id=200846556 instance=ExtResource("4_pkg7o")] position = Vector2(7865, -18.128824) +[node name="Pharaoh4" parent="." unique_id=439750165 instance=ExtResource("15_hiqwa")] +position = Vector2(4097, 175.26888) + [connection signal="toggled" from="CanvasLayer/MusicButton" to="CanvasLayer/MusicButton" method="_on_toggled"]