a game about throwing hammers made for the github game off
implement moving platforms into levels
| -rw-r--r-- | assets/world/moving_platform.png | bin | 157 -> 184 bytes | |||
| -rw-r--r-- | hammers/hammer_01.tscn | 4 | ||||
| -rw-r--r-- | hammers/hammer_02.tscn | 4 | ||||
| -rw-r--r-- | hammers/hammer_03.tscn | 12 | ||||
| -rw-r--r-- | levels/Level.gd | 20 | ||||
| -rw-r--r-- | levels/rand/05.tscn | 14 | ||||
| -rw-r--r-- | levels/rand/07.tscn | 14 | ||||
| -rw-r--r-- | levels/rand/08.tscn | 14 | ||||
| -rw-r--r-- | levels/rand/11.tscn | 14 | ||||
| -rw-r--r-- | levels/rand/17.tscn | 14 | ||||
| -rw-r--r-- | levels/rand/20.tscn | 14 | ||||
| -rw-r--r-- | player/player.gd | 2 | ||||
| -rw-r--r-- | player/player.tscn | 2 | ||||
| -rw-r--r-- | project.godot | 1 | ||||
| -rw-r--r-- | world/moving_platform/moving_platform.gd | 1 | ||||
| -rw-r--r-- | world/moving_platform/moving_platform.tscn | 29 |
16 files changed, 116 insertions, 43 deletions
diff --git a/assets/world/moving_platform.png b/assets/world/moving_platform.png Binary files differindex a1f493c..5fe8d1c 100644 --- a/assets/world/moving_platform.png +++ b/assets/world/moving_platform.png diff --git a/hammers/hammer_01.tscn b/hammers/hammer_01.tscn index a39d5df..b57f4bb 100644 --- a/hammers/hammer_01.tscn +++ b/hammers/hammer_01.tscn @@ -4,7 +4,7 @@ [ext_resource type="Shader" path="res://hammers/hammer_outline.gdshader" id="2_le3ds"] [ext_resource type="Texture2D" uid="uid://dcf5es758pw1n" path="res://assets/hammers/hammer01.png" id="2_sdlv5"] -[sub_resource type="ShaderMaterial" id="ShaderMaterial_u0220"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_ovq2e"] resource_local_to_scene = true shader = ExtResource("2_le3ds") shader_parameter/light_offset = 1.0 @@ -14,7 +14,7 @@ shader_parameter/sin_frequency = 0.25 [node name="Hammer01" instance=ExtResource("1_350hj")] [node name="Sprite" parent="." index="1"] -material = SubResource("ShaderMaterial_u0220") +material = SubResource("ShaderMaterial_ovq2e") texture = ExtResource("2_sdlv5") [editable path="Hitbox"] diff --git a/hammers/hammer_02.tscn b/hammers/hammer_02.tscn index 7d4816b..282b757 100644 --- a/hammers/hammer_02.tscn +++ b/hammers/hammer_02.tscn @@ -4,7 +4,7 @@ [ext_resource type="Texture2D" uid="uid://bcpy0wbrlmqsq" path="res://assets/hammers/hammer02.png" id="2_dmvhv"] [ext_resource type="Shader" path="res://hammers/hammer_outline.gdshader" id="2_rf70p"] -[sub_resource type="ShaderMaterial" id="ShaderMaterial_6ejuw"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_xuktl"] resource_local_to_scene = true shader = ExtResource("2_rf70p") shader_parameter/light_offset = 1.0 @@ -14,7 +14,7 @@ shader_parameter/sin_frequency = 0.25 [node name="Hammer02" instance=ExtResource("1_vy2k1")] [node name="Sprite" parent="." index="1"] -material = SubResource("ShaderMaterial_6ejuw") +material = SubResource("ShaderMaterial_xuktl") texture = ExtResource("2_dmvhv") [node name="Hitbox" parent="." index="3"] diff --git a/hammers/hammer_03.tscn b/hammers/hammer_03.tscn index 0225f48..aa80f11 100644 --- a/hammers/hammer_03.tscn +++ b/hammers/hammer_03.tscn @@ -4,32 +4,32 @@ [ext_resource type="Texture2D" uid="uid://blx67dnlqysnc" path="res://assets/hammers/hammer03.png" id="2_0uj7a"] [ext_resource type="Shader" path="res://hammers/hammer_outline.gdshader" id="2_huryw"] -[sub_resource type="ShaderMaterial" id="ShaderMaterial_wq5re"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_xjagk"] resource_local_to_scene = true shader = ExtResource("2_huryw") shader_parameter/light_offset = 1.0 shader_parameter/line_width = 0.0 shader_parameter/sin_frequency = 0.25 -[sub_resource type="RectangleShape2D" id="RectangleShape2D_2xwsd"] +[sub_resource type="RectangleShape2D" id="RectangleShape2D_fvd8k"] size = Vector2(8, 12) -[sub_resource type="RectangleShape2D" id="RectangleShape2D_lidys"] +[sub_resource type="RectangleShape2D" id="RectangleShape2D_f12fv"] size = Vector2(8, 12) [node name="Hammer03" instance=ExtResource("1_wc0io")] [node name="Sprite" parent="." index="1"] -material = SubResource("ShaderMaterial_wq5re") +material = SubResource("ShaderMaterial_xjagk") texture = ExtResource("2_0uj7a") [node name="Collision" parent="." index="2"] -shape = SubResource("RectangleShape2D_2xwsd") +shape = SubResource("RectangleShape2D_fvd8k") [node name="Hitbox" parent="." index="3"] damage = 3 [node name="Collision" parent="Hitbox" index="0"] -shape = SubResource("RectangleShape2D_lidys") +shape = SubResource("RectangleShape2D_f12fv") [editable path="Hitbox"] diff --git a/levels/Level.gd b/levels/Level.gd index 33dcda8..7510149 100644 --- a/levels/Level.gd +++ b/levels/Level.gd @@ -8,8 +8,6 @@ const BlockDoor_scn := preload("res://world/door/block_door.tscn") const Door_scn := preload("res://world/door/door.tscn") const OneWayPlatform_scn := preload("res://world/one_way_platform.tscn") -const ALL_DOORS := [Vector2i.UP, Vector2i.DOWN, Vector2i.LEFT, Vector2i.RIGHT] - ## The enabled walls. [url=https://kidscancode.org/blog/img/cells_4bit.png]4bit[/url] @export_range(0, 15) var enabled_walls := 15 @@ -36,22 +34,16 @@ func create_node(p_name: StringName) -> Node2D: n.position = Vector2.ZERO n.name = p_name add_child(n) + move_child(n, 0) return n func _ready(): - var wall_array := Maze.tile_4b_to_wall_array(enabled_walls) + var door_array := Maze.tile_4b_to_path_array(enabled_walls) if completed: ($Enemys as Node2D).queue_free() - if len(wall_array) != 4: - var door_array := Util.sub(ALL_DOORS, wall_array) - if Vector2i.DOWN in door_array: - var n := create_node(&"one_way_platform") - n.position = Vector2(128, 243) - var p: OneWayPlatform = OneWayPlatform_scn.instantiate() - n.call_deferred(&"add_child", p) - + if !door_array.is_empty(): if has_enemys: blockdoors = create_node(&"block_doors") @@ -60,6 +52,12 @@ func _ready(): if has_enemys: add_block_door(door) + if Vector2i.DOWN in door_array: + var n := create_node(&"one_way_platform") + n.position = Vector2(128, 243) + var p: OneWayPlatform = OneWayPlatform_scn.instantiate() + n.call_deferred(&"add_child", p) + for enemy in enemys: enemy.died.connect(_on_enemy_died) diff --git a/levels/rand/05.tscn b/levels/rand/05.tscn index 8a126ba..e9717fc 100644 --- a/levels/rand/05.tscn +++ b/levels/rand/05.tscn @@ -1,7 +1,14 @@ -[gd_scene load_steps=3 format=3 uid="uid://hr0ueup48w71"] +[gd_scene load_steps=5 format=3 uid="uid://hr0ueup48w71"] [ext_resource type="PackedScene" uid="uid://dxx21fiom4ef1" path="res://levels/Level.tscn" id="1_6wqlc"] [ext_resource type="PackedScene" uid="uid://b0s1su8xjtxdj" path="res://enemys/wrencher.tscn" id="2_biat4"] +[ext_resource type="PackedScene" uid="uid://dup8mgagrc2b6" path="res://world/moving_platform/moving_platform.tscn" id="3_g4twj"] + +[sub_resource type="Curve2D" id="Curve2D_6ky5g"] +_data = { +"points": PackedVector2Array(0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, -72) +} +point_count = 2 [node name="05" instance=ExtResource("1_6wqlc")] layer_0/tile_data = PackedInt32Array(131072, 196608, 1, 196608, 196608, 1, 262144, 196608, 1, 327680, 196608, 1, 393216, 196608, 2, 589824, 196608, 0, 655360, 196608, 1, 720896, 196608, 1, 786432, 196608, 1, 851968, 196608, 1, 917504, 196608, 1, 983040, 262144, 3, 983041, 65536, 3, 2, 65536, 3, 983042, 65536, 3, 3, 65536, 3, 983043, 65536, 3, 4, 65536, 3, 983044, 65536, 3, 5, 65536, 3, 983045, 65536, 3, 6, 131072, 3, 393222, 589824, 0, 524294, 0, 1, 589830, 0, 2, 983046, 131072, 3, 524295, 65536, 1, 589831, 65536, 2, 393224, 65536, 0, 458760, 65536, 1, 524296, 65536, 1, 589832, 65536, 2, 9, 0, 3, 393225, 131072, 0, 458761, 131072, 1, 524297, 327680, 2, 589833, 393216, 1, 983049, 0, 3, 10, 65536, 3, 983050, 65536, 3, 11, 65536, 3, 983051, 393216, 3, 12, 65536, 3, 983052, 65536, 2, 13, 65536, 3, 983053, 65536, 2, 14, 65536, 3, 983054, 65536, 2, 15, 458752, 0, 65551, 196608, 1, 131087, 196608, 1, 196623, 196608, 1, 262159, 196608, 1, 327695, 196608, 1, 393231, 196608, 1, 589839, 196608, 1, 655375, 196608, 1, 720911, 196608, 1, 786447, 458752, 2, 851983, 131072, 1, 917519, 131072, 1, 983055, 131072, 2, 65536, 196608, 1, 0, 262144, 0, 1, 65536, 3, 458758, 0, 1, 393223, 65536, 0, 458759, 65536, 1, 458767, 196608, 1, 524303, 196608, 1, 917518, 65536, 1, 917517, 65536, 1, 851981, 393216, 2, 851982, 65536, 1, 786446, 65536, 0, 786445, 0, 0, 851980, 0, 0, 917516, 393216, 2, 917515, 0, 0, 131074, 0, 0, 196610, 0, 1, 262146, 0, 2, 262147, 393216, 1, 262148, 327680, 2, 196612, 131072, 1, 196611, 65536, 1, 131075, 65536, 0, 131076, 131072, 0, 262149, 65536, 0, 327685, 393216, 1, 327686, 131072, 1, 262150, 131072, 0, 393221, 0, 2, 327684, 65536, 2, 327683, 0, 2, 655369, 0, 1, 720905, 0, 2, 720906, 131072, 2, 655370, 131072, 1, 589834, 131072, 1, 524298, 131072, 0, 720900, 131072, 0, 720899, 0, 0, 786435, 0, 2, 786436, 131072, 2) @@ -10,3 +17,8 @@ enabled_walls = 2 [node name="Wrencher" parent="Enemys" index="0" instance=ExtResource("2_biat4")] position = Vector2(235, 97) rotation = -1.57079 + +[node name="MovingPlatform" parent="." index="1" instance=ExtResource("3_g4twj")] +position = Vector2(130, 100) +curve = SubResource("Curve2D_6ky5g") +playback_speed = 0.5 diff --git a/levels/rand/07.tscn b/levels/rand/07.tscn index e89d0f5..848ecd5 100644 --- a/levels/rand/07.tscn +++ b/levels/rand/07.tscn @@ -1,7 +1,14 @@ -[gd_scene load_steps=3 format=3 uid="uid://dsjel2dj0wjo2"] +[gd_scene load_steps=5 format=3 uid="uid://dsjel2dj0wjo2"] [ext_resource type="PackedScene" uid="uid://dxx21fiom4ef1" path="res://levels/Level.tscn" id="1_3bnrf"] [ext_resource type="PackedScene" uid="uid://b0s1su8xjtxdj" path="res://enemys/wrencher.tscn" id="2_5j31a"] +[ext_resource type="PackedScene" uid="uid://dup8mgagrc2b6" path="res://world/moving_platform/moving_platform.tscn" id="3_h1qi5"] + +[sub_resource type="Curve2D" id="Curve2D_o2282"] +_data = { +"points": PackedVector2Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -192) +} +point_count = 2 [node name="07" instance=ExtResource("1_3bnrf")] layer_0/tile_data = PackedInt32Array(131072, 196608, 1, 196608, 196608, 1, 262144, 262144, 2, 327680, 262144, 1, 393216, 196608, 2, 589824, 196608, 0, 655360, 196608, 1, 720896, 196608, 1, 786432, 196608, 1, 851968, 196608, 1, 917504, 196608, 1, 983040, 262144, 3, 983041, 65536, 3, 2, 65536, 3, 983042, 65536, 3, 3, 65536, 3, 983043, 65536, 3, 4, 65536, 3, 983044, 65536, 3, 5, 65536, 3, 983045, 65536, 3, 6, 131072, 3, 393222, 327680, 2, 524294, 393216, 1, 589830, 0, 2, 983046, 65536, 3, 524295, 65536, 1, 589831, 65536, 2, 393224, 65536, 0, 458760, 65536, 1, 524296, 65536, 1, 589832, 65536, 2, 9, 0, 3, 393225, 65536, 0, 458761, 65536, 1, 524297, 327680, 1, 589833, 131072, 2, 983049, 65536, 3, 10, 65536, 3, 983050, 65536, 3, 11, 65536, 3, 983051, 65536, 3, 12, 65536, 3, 983052, 65536, 3, 13, 65536, 3, 983053, 65536, 3, 14, 65536, 3, 983054, 65536, 3, 15, 458752, 0, 65551, 196608, 1, 131087, 196608, 1, 196623, 196608, 1, 262159, 196608, 1, 327695, 196608, 1, 393231, 196608, 2, 589839, 196608, 0, 655375, 196608, 1, 720911, 196608, 1, 786447, 196608, 1, 851983, 196608, 1, 917519, 196608, 1, 983055, 458752, 3, 65536, 196608, 1, 0, 262144, 0, 1, 65536, 3, 458758, 65536, 1, 393223, 65536, 0, 458759, 65536, 1, 983047, 65536, 3, 983048, 65536, 3, 327681, 131072, 2, 262145, 131072, 0, 196612, 0, 0, 262148, 0, 1, 327684, 0, 1, 327685, 327680, 2, 262149, 131072, 1, 196613, 131072, 0, 393221, 393216, 1, 393220, 0, 2, 458757, 0, 1, 524293, 0, 2, 327686, 131072, 0, 524298, 131072, 2, 458762, 327680, 1, 458763, 131072, 2, 393227, 327680, 1, 393226, 65537, 0, 327690, 1, 0, 327691, 65537, 0, 262155, 0, 1, 262156, 131072, 1, 196620, 131072, 0, 196619, 0, 0, 327692, 131072, 1, 393228, 131072, 2) @@ -9,3 +16,8 @@ enabled_walls = 4 [node name="Wrencher" parent="Enemys" index="0" instance=ExtResource("2_5j31a")] position = Vector2(82, 235) + +[node name="MovingPlatform" parent="." index="1" instance=ExtResource("3_h1qi5")] +position = Vector2(224, 245) +curve = SubResource("Curve2D_o2282") +playback_speed = 0.3 diff --git a/levels/rand/08.tscn b/levels/rand/08.tscn index 5c456fa..e7de10b 100644 --- a/levels/rand/08.tscn +++ b/levels/rand/08.tscn @@ -1,7 +1,14 @@ -[gd_scene load_steps=3 format=3 uid="uid://s1lsinwfques"] +[gd_scene load_steps=5 format=3 uid="uid://s1lsinwfques"] [ext_resource type="PackedScene" uid="uid://dxx21fiom4ef1" path="res://levels/Level.tscn" id="1_4ldoi"] [ext_resource type="PackedScene" uid="uid://b0s1su8xjtxdj" path="res://enemys/wrencher.tscn" id="2_qq88x"] +[ext_resource type="PackedScene" uid="uid://dup8mgagrc2b6" path="res://world/moving_platform/moving_platform.tscn" id="3_xv2ak"] + +[sub_resource type="Curve2D" id="Curve2D_3bouo"] +_data = { +"points": PackedVector2Array(0, 0, 0, 0, -1, 3, 0, 0, 0, 0, -1, -89, 0, 0, 0, 0, 111, -89) +} +point_count = 3 [node name="08" instance=ExtResource("1_4ldoi")] layer_0/tile_data = PackedInt32Array(131072, 0, 1, 196608, 0, 1, 262144, 0, 1, 327680, 0, 1, 393216, 0, 2, 786432, 0, 1, 851968, 0, 1, 917504, 0, 1, 983040, 0, 2, 983041, 65536, 2, 2, 65536, 0, 983042, 65536, 2, 3, 65536, 0, 983043, 327680, 3, 4, 65536, 0, 983044, 65536, 3, 5, 65536, 0, 983045, 393216, 3, 6, 65536, 0, 983046, 65536, 2, 9, 65536, 0, 983049, 65536, 2, 10, 65536, 0, 983050, 65536, 2, 11, 65536, 0, 983051, 65536, 2, 12, 65536, 0, 983052, 65536, 2, 13, 65536, 0, 983053, 65536, 2, 14, 65536, 0, 983054, 65536, 2, 15, 131072, 0, 65551, 131072, 1, 131087, 131072, 1, 196623, 131072, 1, 262159, 131072, 1, 327695, 131072, 1, 393231, 131072, 2, 589839, 131072, 0, 655375, 131072, 1, 720911, 131072, 1, 786447, 131072, 1, 851983, 131072, 1, 917519, 131072, 1, 983055, 131072, 2, 65536, 0, 1, 0, 0, 0, 1, 65536, 0, 7, 65536, 0, 8, 65536, 0, 983047, 65536, 2, 983048, 65536, 2, 917518, 65536, 1, 851982, 65536, 1, 786446, 65536, 1, 720910, 393216, 2, 655374, 0, 1, 589838, 0, 0, 917517, 65536, 1, 851981, 65536, 1, 786445, 65536, 1, 720909, 65536, 0, 917516, 65536, 1, 851980, 65536, 1, 786444, 393216, 2, 720908, 0, 0, 917515, 65536, 1, 851979, 65536, 1, 786443, 65536, 0, 917514, 65536, 1, 851978, 65536, 1, 786442, 65536, 0, 917513, 65536, 1, 851977, 393216, 2, 786441, 0, 0, 917512, 65536, 1, 851976, 65536, 0, 917511, 65536, 1, 851975, 65536, 0, 917510, 393216, 2, 851974, 0, 0, 917509, 0, 0, 917507, 131072, 1, 851971, 131072, 0, 917506, 65536, 1, 851970, 327680, 2, 786434, 131072, 0, 917505, 65536, 1, 851969, 65536, 1, 786433, 327680, 2, 393230, 0, 2, 327694, 393216, 1, 262158, 65536, 1, 196622, 65536, 1, 131086, 65536, 1, 65550, 65536, 1, 327693, 0, 2, 262157, 393216, 1, 196621, 65536, 1, 131085, 65536, 1, 65549, 65536, 1, 262156, 65536, 2, 196620, 65536, 1, 131084, 65536, 1, 65548, 65536, 1, 262155, 65536, 2, 196619, 65536, 1, 131083, 65536, 1, 65547, 65536, 1, 262154, 0, 2, 196618, 393216, 1, 131082, 65536, 1, 65546, 65536, 1, 196617, 65536, 2, 131081, 65536, 1, 65545, 65536, 1, 196616, 65536, 2, 131080, 65536, 1, 65544, 65536, 1, 262151, 131072, 2, 196615, 327680, 1, 131079, 65536, 1, 65543, 65536, 1, 262150, 65536, 2, 196614, 65536, 1, 131078, 65536, 1, 65542, 65536, 1, 262149, 0, 2, 196613, 393216, 1, 131077, 65536, 1, 65541, 65536, 1, 196612, 65536, 2, 131076, 65536, 1, 65540, 65536, 1, 196611, 65536, 2, 131075, 65536, 1, 65539, 65536, 1, 196610, 65536, 2, 131074, 65536, 1, 65538, 65536, 1, 393217, 131072, 2, 327681, 131072, 1, 262145, 131072, 1, 196609, 327680, 1, 131073, 65536, 1, 65537, 65536, 1, 720897, 131072, 0, 720896, 262144, 2, 655360, 196608, 1, 589824, 196608, 0) @@ -13,3 +20,8 @@ position = Vector2(152, 187) [node name="Wrencher2" parent="Enemys" index="1" instance=ExtResource("2_qq88x")] position = Vector2(109, 85) rotation = 3.14159 + +[node name="MovingPlatform" parent="." index="1" instance=ExtResource("3_xv2ak")] +position = Vector2(65, 194) +curve = SubResource("Curve2D_3bouo") +playback_speed = 0.1 diff --git a/levels/rand/11.tscn b/levels/rand/11.tscn index 939ef07..ebf3ae3 100644 --- a/levels/rand/11.tscn +++ b/levels/rand/11.tscn @@ -1,7 +1,14 @@ -[gd_scene load_steps=3 format=3 uid="uid://dip1l1cd8s8p0"] +[gd_scene load_steps=5 format=3 uid="uid://dip1l1cd8s8p0"] [ext_resource type="PackedScene" uid="uid://dxx21fiom4ef1" path="res://levels/Level.tscn" id="1_pa3ds"] [ext_resource type="PackedScene" uid="uid://b0s1su8xjtxdj" path="res://enemys/wrencher.tscn" id="2_gdari"] +[ext_resource type="PackedScene" uid="uid://dup8mgagrc2b6" path="res://world/moving_platform/moving_platform.tscn" id="3_giytt"] + +[sub_resource type="Curve2D" id="Curve2D_mxbaw"] +_data = { +"points": PackedVector2Array(0, 0, 0, 0, -1.52588e-05, -1.52588e-05, 0, 0, 0, 0, 0, -184) +} +point_count = 2 [node name="11" instance=ExtResource("1_pa3ds")] layer_0/tile_data = PackedInt32Array(131072, 196608, 1, 196608, 196608, 1, 262144, 196608, 1, 327680, 196608, 1, 393216, 196608, 1, 589824, 196608, 1, 655360, 196608, 1, 720896, 196608, 1, 786432, 196608, 1, 851968, 262144, 2, 917504, 0, 1, 983040, 0, 2, 983041, 65536, 2, 2, 65536, 3, 983042, 327680, 3, 3, 65536, 3, 983043, 65536, 3, 4, 65536, 3, 983044, 65536, 3, 5, 65536, 3, 983045, 65536, 3, 6, 458752, 0, 983046, 131072, 3, 9, 0, 3, 983049, 0, 3, 10, 65536, 3, 983050, 65536, 3, 11, 65536, 3, 983051, 65536, 3, 12, 65536, 3, 983052, 65536, 3, 13, 393216, 0, 983053, 65536, 3, 14, 65536, 0, 983054, 65536, 3, 15, 131072, 0, 65551, 131072, 1, 131087, 458752, 1, 196623, 196608, 1, 262159, 196608, 1, 327695, 196608, 1, 393231, 196608, 2, 589839, 196608, 0, 655375, 196608, 1, 720911, 196608, 1, 786447, 196608, 1, 851983, 196608, 1, 917519, 196608, 1, 983055, 458752, 3, 65536, 196608, 1, 0, 262144, 0, 1, 65536, 3, 524288, 196608, 1, 458752, 196608, 1, 65550, 65536, 1, 131085, 589824, 1, 196620, 589824, 1, 262155, 589824, 1, 327690, 589824, 1, 393225, 0, 2, 589830, 131072, 0, 655365, 589824, 1, 720900, 589824, 1, 786435, 589824, 1, 851970, 589824, 1, 917505, 65536, 1, 131086, 65536, 2, 196621, 131072, 2, 262156, 131072, 2, 327691, 131072, 2, 393226, 131072, 2, 655366, 131072, 2, 720901, 131072, 2, 786436, 131072, 2, 851971, 131072, 2, 917506, 131072, 1, 851969, 65536, 0, 786434, 0, 0, 720899, 0, 0, 655364, 0, 0, 589829, 0, 0, 327689, 0, 0, 262154, 0, 0, 196619, 0, 0, 131084, 0, 0, 65549, 0, 1, 131078, 196608, 1, 65542, 196608, 1, 196614, 196608, 2) @@ -14,3 +21,8 @@ rotation = 1.57079 [node name="Wrencher2" parent="Enemys" index="1" instance=ExtResource("2_gdari")] position = Vector2(235, 188) rotation = 4.71238 + +[node name="MovingPlatform" parent="." index="1" instance=ExtResource("3_giytt")] +position = Vector2(128, 244) +curve = SubResource("Curve2D_mxbaw") +playback_speed = 0.4 diff --git a/levels/rand/17.tscn b/levels/rand/17.tscn index c37b83d..da37d30 100644 --- a/levels/rand/17.tscn +++ b/levels/rand/17.tscn @@ -1,7 +1,14 @@ -[gd_scene load_steps=3 format=3 uid="uid://pk206siyyege"] +[gd_scene load_steps=5 format=3 uid="uid://pk206siyyege"] [ext_resource type="PackedScene" uid="uid://dxx21fiom4ef1" path="res://levels/Level.tscn" id="1_otvl3"] [ext_resource type="PackedScene" uid="uid://b0s1su8xjtxdj" path="res://enemys/wrencher.tscn" id="2_d40ci"] +[ext_resource type="PackedScene" uid="uid://dup8mgagrc2b6" path="res://world/moving_platform/moving_platform.tscn" id="3_y8t4g"] + +[sub_resource type="Curve2D" id="Curve2D_nauqg"] +_data = { +"points": PackedVector2Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -193) +} +point_count = 2 [node name="17" instance=ExtResource("1_otvl3")] layer_0/tile_data = PackedInt32Array(131072, 196608, 1, 196608, 196608, 1, 262144, 196608, 1, 327680, 196608, 1, 393216, 196608, 1, 589824, 196608, 1, 655360, 196608, 1, 720896, 196608, 1, 786432, 262144, 2, 851968, 0, 1, 917504, 0, 1, 983040, 0, 2, 983041, 65536, 2, 2, 65536, 3, 983042, 327680, 3, 3, 65536, 3, 983043, 65536, 3, 4, 65536, 3, 983044, 65536, 3, 5, 65536, 3, 983045, 65536, 3, 6, 131072, 3, 983046, 65536, 3, 9, 0, 3, 983049, 65536, 3, 10, 65536, 3, 983050, 65536, 3, 11, 65536, 3, 983051, 65536, 3, 12, 65536, 3, 983052, 65536, 3, 13, 65536, 3, 983053, 393216, 3, 14, 65536, 3, 983054, 65536, 2, 15, 458752, 0, 65551, 196608, 1, 131087, 196608, 1, 196623, 196608, 1, 262159, 196608, 1, 327695, 196608, 1, 393231, 196608, 1, 589839, 196608, 1, 655375, 196608, 1, 720911, 196608, 1, 786447, 458752, 2, 851983, 131072, 1, 917519, 131072, 1, 983055, 131072, 2, 65536, 196608, 1, 0, 262144, 0, 1, 65536, 3, 458752, 196608, 1, 524288, 196608, 1, 786433, 131072, 0, 917505, 327680, 2, 851969, 131072, 1, 917506, 131072, 0, 983047, 65536, 3, 983048, 65536, 3, 524303, 196608, 1, 458767, 196608, 1, 917518, 65536, 1, 851982, 393216, 2, 786446, 0, 0, 851981, 0, 0, 917517, 0, 1, 262149, 0, 2, 262150, 131072, 2, 196614, 131072, 0, 196613, 0, 0, 327689, 0, 0, 393225, 0, 2, 393226, 131072, 2, 327690, 131072, 0, 458757, 0, 0, 458758, 131072, 0, 524294, 131072, 2, 524293, 0, 2, 589833, 0, 0, 655369, 0, 2, 655370, 131072, 2, 589834, 131072, 0, 786437, 0, 0, 851973, 0, 2, 851974, 131072, 2, 786438, 131072, 0, 851977, 196608, 3, 196617, 0, 3, 196618, 131072, 3, 327692, 0, 0, 327693, 131072, 0, 393229, 131072, 2, 393228, 0, 2, 196610, 0, 0, 196611, 131072, 0, 262147, 131072, 2, 262146, 0, 2, 524290, 0, 3, 524291, 131072, 3, 655362, 0, 3, 655363, 131072, 3, 655372, 0, 3, 655373, 131072, 3, 524300, 0, 3, 524301, 131072, 3) @@ -20,3 +27,8 @@ max_health = 2 position = Vector2(235, 63) rotation = 4.71238 max_health = 3 + +[node name="MovingPlatform" parent="." index="1" instance=ExtResource("3_y8t4g")] +position = Vector2(128, 245) +curve = SubResource("Curve2D_nauqg") +playback_speed = 0.3 diff --git a/levels/rand/20.tscn b/levels/rand/20.tscn index fa62cf5..9236691 100644 --- a/levels/rand/20.tscn +++ b/levels/rand/20.tscn @@ -1,7 +1,14 @@ -[gd_scene load_steps=3 format=3 uid="uid://ca1yl8qy2tkhh"] +[gd_scene load_steps=5 format=3 uid="uid://ca1yl8qy2tkhh"] [ext_resource type="PackedScene" uid="uid://dxx21fiom4ef1" path="res://levels/Level.tscn" id="1_s3k3r"] [ext_resource type="PackedScene" uid="uid://b0s1su8xjtxdj" path="res://enemys/wrencher.tscn" id="2_ltna7"] +[ext_resource type="PackedScene" uid="uid://dup8mgagrc2b6" path="res://world/moving_platform/moving_platform.tscn" id="3_714l6"] + +[sub_resource type="Curve2D" id="Curve2D_m4cug"] +_data = { +"points": PackedVector2Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -177) +} +point_count = 2 [node name="20" instance=ExtResource("1_s3k3r")] layer_0/tile_data = PackedInt32Array(131072, 196608, 1, 196608, 196608, 1, 262144, 196608, 1, 327680, 196608, 1, 393216, 196608, 2, 589824, 196608, 0, 655360, 196608, 1, 720896, 196608, 1, 786432, 196608, 1, 851968, 196608, 1, 917504, 196608, 1, 983040, 262144, 3, 983041, 65536, 3, 2, 65536, 3, 983042, 65536, 3, 3, 65536, 3, 983043, 65536, 3, 4, 65536, 3, 983044, 65536, 3, 5, 65536, 3, 983045, 65536, 3, 6, 131072, 3, 393222, 0, 1, 524294, 0, 1, 589830, 0, 2, 983046, 131072, 3, 524295, 65536, 1, 589831, 65536, 2, 393224, 65536, 1, 458760, 65536, 1, 524296, 65536, 1, 589832, 65536, 2, 9, 0, 3, 393225, 65536, 1, 458761, 65536, 1, 524297, 65536, 1, 589833, 65536, 2, 983049, 0, 3, 10, 65536, 3, 983050, 65536, 3, 11, 65536, 3, 983051, 65536, 3, 12, 65536, 3, 983052, 65536, 3, 13, 65536, 3, 983053, 65536, 3, 14, 65536, 3, 983054, 65536, 3, 15, 458752, 0, 65551, 196608, 1, 131087, 196608, 1, 196623, 196608, 1, 262159, 196608, 1, 327695, 196608, 1, 393231, 458752, 2, 589839, 458752, 1, 655375, 196608, 1, 720911, 196608, 1, 786447, 196608, 1, 851983, 196608, 1, 917519, 196608, 1, 983055, 458752, 3, 65536, 196608, 1, 0, 262144, 0, 1, 65536, 3, 458758, 0, 1, 393223, 65536, 1, 458759, 65536, 1, 524303, 131072, 1, 458766, 65536, 1, 458767, 131072, 1, 589838, 65536, 2, 524302, 65536, 1, 393230, 65536, 0, 589837, 65536, 2, 524301, 65536, 1, 458765, 65536, 1, 393229, 65536, 0, 589836, 65536, 2, 524300, 65536, 1, 458764, 65536, 1, 393228, 65536, 0, 589835, 65536, 2, 524299, 65536, 1, 458763, 65536, 1, 393227, 65536, 0, 589834, 65536, 2, 524298, 65536, 1, 458762, 65536, 1, 393226, 327680, 2, 327686, 0, 1, 262150, 0, 0, 262151, 393216, 2, 327687, 65536, 1, 327688, 65536, 1, 327689, 327680, 2, 262153, 131072, 0, 262152, 327680, 2, 196615, 0, 0, 196616, 131072, 0, 327690, 131072, 0) @@ -10,3 +17,8 @@ enabled_walls = 2 [node name="Wrencher" parent="Enemys" index="0" instance=ExtResource("2_ltna7")] position = Vector2(91, 151) rotation = -1.57079 + +[node name="MovingPlatform" parent="." index="1" instance=ExtResource("3_714l6")] +position = Vector2(80, 245) +curve = SubResource("Curve2D_m4cug") +playback_speed = 0.4 diff --git a/player/player.gd b/player/player.gd index 27126c6..9d45ec1 100644 --- a/player/player.gd +++ b/player/player.gd @@ -157,7 +157,7 @@ func hammer_highlight() -> void: hamms[0].highlight() func hammer_pickup() -> void: - if Input.is_action_just_pressed("pickup") and last_highlit and not current_hammer: + if Input.is_action_just_pressed("pickup") and is_instance_valid(last_highlit) and not current_hammer: last_highlit.unhighlight() current_hammer = last_highlit Globals.levelmanager.current_level.remove_child(current_hammer) diff --git a/player/player.tscn b/player/player.tscn index 14c350a..5a45b93 100644 --- a/player/player.tscn +++ b/player/player.tscn @@ -105,7 +105,9 @@ radius = 21.0 [node name="player" type="CharacterBody2D"] collision_layer = 2 +collision_mask = 129 floor_max_angle = 0.802851 +platform_floor_layers = 128 script = ExtResource("1_lnsyt") [node name="Sprite" type="Sprite2D" parent="."] diff --git a/project.godot b/project.godot index cbe09dd..1630f2b 100644 --- a/project.godot +++ b/project.godot @@ -235,6 +235,7 @@ throw={ 2d_physics/layer_5="enemy" 2d_physics/layer_6="hammer" 2d_physics/layer_7="hammer_inactive" +2d_physics/layer_8="moving_platform" [logging] diff --git a/world/moving_platform/moving_platform.gd b/world/moving_platform/moving_platform.gd index 669642d..42c28b6 100644 --- a/world/moving_platform/moving_platform.gd +++ b/world/moving_platform/moving_platform.gd @@ -4,3 +4,4 @@ extends Node2D func _ready() -> void: $player.playback_speed = playback_speed + diff --git a/world/moving_platform/moving_platform.tscn b/world/moving_platform/moving_platform.tscn index e170949..0dc8bba 100644 --- a/world/moving_platform/moving_platform.tscn +++ b/world/moving_platform/moving_platform.tscn @@ -2,15 +2,10 @@ [ext_resource type="Script" path="res://world/moving_platform/moving_platform.gd" id="1_0sweg"] [ext_resource type="Texture2D" uid="uid://cdg0t1suvcfmt" path="res://assets/world/moving_platform.png" id="1_43vys"] - -[sub_resource type="Curve2D" id="Curve2D_jodtc"] -_data = { -"points": PackedVector2Array(0, 0, 0, 0, 0, 0) -} -point_count = 1 +[ext_resource type="Script" path="res://world/one_way_platform.gd" id="2_fhxgs"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_0ri1c"] -size = Vector2(34, 10) +size = Vector2(32, 10) [sub_resource type="Animation" id="Animation_oma2q"] resource_name = "play" @@ -18,7 +13,7 @@ loop_mode = 1 tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true -tracks/0/path = NodePath("follower:progress_ratio") +tracks/0/path = NodePath("s:progress_ratio") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/keys = { @@ -34,21 +29,25 @@ _data = { } [node name="MovingPlatform" type="Path2D"] -curve = SubResource("Curve2D_jodtc") script = ExtResource("1_0sweg") -[node name="follower" type="PathFollow2D" parent="."] -position = Vector2(0, 5) +[node name="s" type="PathFollow2D" parent="."] rotates = false loop = false -[node name="platf" type="AnimatableBody2D" parent="follower"] -position = Vector2(0, -5) +[node name="transfer" type="RemoteTransform2D" parent="s"] +remote_path = NodePath("../../platf") + +[node name="platf" type="AnimatableBody2D" parent="." node_paths=PackedStringArray("shape")] +collision_layer = 128 +collision_mask = 128 +script = ExtResource("2_fhxgs") +shape = NodePath("CollisionShape2D") -[node name="sprite" type="Sprite2D" parent="follower/platf"] +[node name="sprite" type="Sprite2D" parent="platf"] texture = ExtResource("1_43vys") -[node name="CollisionShape2D" type="CollisionShape2D" parent="follower/platf"] +[node name="CollisionShape2D" type="CollisionShape2D" parent="platf"] visible = false shape = SubResource("RectangleShape2D_0ri1c") one_way_collision = true |