From 4dde27c5a357de3b320f6ace853466b684aa351b Mon Sep 17 00:00:00 2001 From: LUCASTUCIOUS Date: Wed, 24 Jul 2024 22:45:32 +0200 Subject: [PATCH] Make the bridge node --- core/bridgeNode.tscn | 38 +++++++++++++++++++ core/player.tscn | 20 +++++----- maps/map1.tscn | 22 +++++++---- prefab/prefab_woddenbridge.tscn | 30 +++++++++++++++ project.godot | 4 ++ ...All_01_SPRT.png => Atlas_Buildings_01.png} | 0 ...g.import => Atlas_Buildings_01.png.import} | 6 +-- ...ds_All_01_SPRT.png => Atlas_Builds_01.png} | 0 ....png.import => Atlas_Builds_01.png.import} | 6 +-- ...ds_All_02_SPRT.png => Atlas_Builds_02.png} | 0 ....png.import => Atlas_Builds_02.png.import} | 6 +-- 11 files changed, 106 insertions(+), 26 deletions(-) create mode 100644 core/bridgeNode.tscn create mode 100644 prefab/prefab_woddenbridge.tscn rename textures/atlas/{Buildings_All_01_SPRT.png => Atlas_Buildings_01.png} (100%) rename textures/atlas/{Buildings_All_01_SPRT.png.import => Atlas_Buildings_01.png.import} (68%) rename textures/atlas/{Builds_All_01_SPRT.png => Atlas_Builds_01.png} (100%) rename textures/atlas/{Builds_All_01_SPRT.png.import => Atlas_Builds_01.png.import} (69%) rename textures/atlas/{Builds_All_02_SPRT.png => Atlas_Builds_02.png} (100%) rename textures/atlas/{Builds_All_02_SPRT.png.import => Atlas_Builds_02.png.import} (69%) diff --git a/core/bridgeNode.tscn b/core/bridgeNode.tscn new file mode 100644 index 0000000..e39b1ef --- /dev/null +++ b/core/bridgeNode.tscn @@ -0,0 +1,38 @@ +[gd_scene load_steps=2 format=3 uid="uid://clqvgh6qmglue"] + +[sub_resource type="GDScript" id="GDScript_8d33s"] +resource_name = "bridge" +script/source = "extends Area2D + +var wallObject : Array + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + pass + + +func _on_body_entered(object): + print(\"Entered %d\",object) + if (object.has_meta(\"Type\") and object.get_meta(\"Type\") == \"Player\" ): + for _object in wallObject: + _object.process_mode = Node.PROCESS_MODE_DISABLED + else: + wallObject.append(object) + + +func _on_body_exited(object): + if (object.has_meta(\"Type\") and object.get_meta(\"Type\") == \"Player\" ): + for _object in wallObject: + _object.process_mode = Node.PROCESS_MODE_INHERIT +" + +[node name="BridgeNode" type="Area2D"] +script = SubResource("GDScript_8d33s") + +[connection signal="body_entered" from="." to="." method="_on_body_entered"] +[connection signal="body_exited" from="." to="." method="_on_body_exited"] diff --git a/core/player.tscn b/core/player.tscn index 7d99c44..731471b 100644 --- a/core/player.tscn +++ b/core/player.tscn @@ -497,10 +497,12 @@ node_connections = [&"output", 0, &"WalkRun"] [sub_resource type="CanvasTexture" id="CanvasTexture_2b3h6"] diffuse_texture = ExtResource("6_3ryww") -[node name="Node2D" type="CharacterBody2D"] +[node name="Player" type="CharacterBody2D"] +motion_mode = 1 script = ExtResource("1_whhfc") CurrentSkin = ExtResource("2_w1l4c") CurrentHat = ExtResource("3_ybl0v") +metadata/Type = "Player" [node name="CollisionShape2D" type="CollisionShape2D" parent="."] position = Vector2(0, -75) @@ -537,23 +539,23 @@ parameters/WalkRun/3/TimeScale/scale = 0.3 position = Vector2(17, 0) [node name="BootL" type="Sprite2D" parent="Skeleton2D"] -position = Vector2(-89.0025, -35.3452) -rotation = 0.380759 +position = Vector2(-51.293, -36.973) +rotation = 0.119813 texture = ExtResource("2_w1l4c") region_enabled = true region_rect = Rect2(896, 768, 128, 128) metadata/Type = "Skin" [node name="BootR" type="Sprite2D" parent="Skeleton2D"] -position = Vector2(36.4409, -41.4027) -rotation = -0.631213 +position = Vector2(5.51367, -43.3018) +rotation = -0.307954 texture = ExtResource("2_w1l4c") region_enabled = true region_rect = Rect2(896, 768, 128, 128) metadata/Type = "Skin" [node name="Body" type="Sprite2D" parent="Skeleton2D"] -position = Vector2(51, -242.428) +position = Vector2(51, -231.006) texture = ExtResource("2_w1l4c") offset = Vector2(-15, 0) region_enabled = true @@ -577,7 +579,7 @@ metadata/Type = "Skin" [node name="Tail" type="Sprite2D" parent="Skeleton2D/Body"] show_behind_parent = true -position = Vector2(44, 112.428) +position = Vector2(44, 101.006) rotation = 0.153589 texture = ExtResource("2_w1l4c") offset = Vector2(70, 0) @@ -586,8 +588,8 @@ region_rect = Rect2(768, 640, 256, 128) metadata/Type = "Skin" [node name="Head" type="Sprite2D" parent="Skeleton2D"] -position = Vector2(-40, -415.428) -rotation = 0.0646754 +position = Vector2(-40, -404.006) +rotation = 0.0641361 texture = ExtResource("2_w1l4c") offset = Vector2(0, -168) region_enabled = true diff --git a/maps/map1.tscn b/maps/map1.tscn index 665aa0b..597ac5b 100644 --- a/maps/map1.tscn +++ b/maps/map1.tscn @@ -1,8 +1,13 @@ -[gd_scene load_steps=4 format=3 uid="uid://wlqsvbqpcbh"] +[gd_scene load_steps=6 format=3 uid="uid://wlqsvbqpcbh"] [ext_resource type="Texture2D" uid="uid://cacwy4tka88k1" path="res://maps/map1.tres" id="1_pt5vq"] -[ext_resource type="Texture2D" uid="uid://db1k2fu0p2ek8" path="res://extracted/Sprite/Floors_11_SPRT_0.png" id="2_ha1lv"] +[ext_resource type="Texture2D" uid="uid://cxharyv0ajr37" path="res://textures/atlas/DioramaEntrance_All_01_SPRT.png" id="2_n7y5f"] [ext_resource type="Texture2D" uid="uid://c5bd2ta3esnib" path="res://extracted/4010-A Tiny Sticker Tale review pic 1.jpg" id="3_yh2wy"] +[ext_resource type="PackedScene" uid="uid://bddcriwo55x8k" path="res://prefab/prefab_woddenbridge.tscn" id="4_okpsn"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_wi524"] +atlas = ExtResource("2_n7y5f") +region = Rect2(256, 0, 104, 288) [node name="Map1" type="Node2D"] @@ -14,18 +19,17 @@ region_rect = Rect2(0, 0, 1024, 992) [node name="StaticBody2D" type="StaticBody2D" parent="Floors05Sprt"] [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Floors05Sprt/StaticBody2D"] -visible = false polygon = PackedVector2Array(-450, 68.3333, -446.167, 162.667, 194.833, 162.667, 211.833, 162.667, 208.167, -35.3333, 462.667, -31.5, 458.833, -131.5, 191.167, -129.667, 191.167, 66.5) [node name="CollisionPolygon2D2" type="CollisionPolygon2D" parent="Floors05Sprt/StaticBody2D"] visible = false build_mode = 1 -polygon = PackedVector2Array(-448, -432.5, 458, -430.833, 455.5, 196.833, 490.333, 198, 497, 305, 453.833, 307.333, 456.167, 411, -448, 407.5) +polygon = PackedVector2Array(-448, -432.5, 458, -430.833, 456.667, 147.667, 529.5, 143.167, 526.167, 348.5, 452.167, 349.5, 456.167, 411, -448, 407.5) -[node name="Sprite2D" type="Sprite2D" parent="Floors05Sprt"] -position = Vector2(477.167, 300.333) -scale = Vector2(0.192195, 0.20323) -texture = ExtResource("2_ha1lv") +[node name="Door" type="Sprite2D" parent="Floors05Sprt"] +z_index = -1 +position = Vector2(491.833, 269.333) +texture = SubResource("AtlasTexture_wi524") [node name="4010-aTinyStickerTaleReviewPic1" type="Sprite2D" parent="."] visible = false @@ -33,3 +37,5 @@ top_level = true position = Vector2(78, -148) scale = Vector2(6.15, 6.15) texture = ExtResource("3_yh2wy") + +[node name="WoodenBridge" parent="." instance=ExtResource("4_okpsn")] diff --git a/prefab/prefab_woddenbridge.tscn b/prefab/prefab_woddenbridge.tscn new file mode 100644 index 0000000..ae7fa57 --- /dev/null +++ b/prefab/prefab_woddenbridge.tscn @@ -0,0 +1,30 @@ +[gd_scene load_steps=4 format=3 uid="uid://bddcriwo55x8k"] + +[ext_resource type="Texture2D" uid="uid://b366mcexlko72" path="res://textures/atlas/LogsAndWood_All_01_SPRT.png" id="1_lvitw"] +[ext_resource type="PackedScene" uid="uid://clqvgh6qmglue" path="res://core/bridgeNode.tscn" id="2_11mpd"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_nkyhf"] +atlas = ExtResource("1_lvitw") +region = Rect2(72, 1392, 216, 272) + +[node name="WoodenBridge" type="Sprite2D"] +position = Vector2(1955, -525) +scale = Vector2(5.71296, 5.71296) +texture = SubResource("AtlasTexture_nkyhf") + +[node name="BridgeNode" parent="." instance=ExtResource("2_11mpd")] +position = Vector2(1788, 788) +collision_layer = 0 + +[node name="PlayerDetection" type="CollisionPolygon2D" parent="BridgeNode"] +position = Vector2(-623.92, 0) +scale = Vector2(0.650499, 1) +polygon = PackedVector2Array(-1875.9, -847.689, -1878.05, -681.225, -1699.64, -682.976, -1706.37, -847.689) + +[node name="StaticBody2D" type="StaticBody2D" parent="."] + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="StaticBody2D"] +polygon = PackedVector2Array(-84.7196, -115.177, -83.3193, 112.026, -58.9886, 111.851, -59.1637, -113.951) + +[node name="CollisionPolygon2D2" type="CollisionPolygon2D" parent="StaticBody2D"] +polygon = PackedVector2Array(56.8882, -107.3, 64.0648, 114.652, 83.3193, 116.052, 84.0194, -116.577) diff --git a/project.godot b/project.godot index 9b267cc..f47e98c 100644 --- a/project.godot +++ b/project.godot @@ -81,6 +81,10 @@ menu={ ] } +[layer_names] + +2d_physics/layer_1="Player" + [rendering] renderer/rendering_method="mobile" diff --git a/textures/atlas/Buildings_All_01_SPRT.png b/textures/atlas/Atlas_Buildings_01.png similarity index 100% rename from textures/atlas/Buildings_All_01_SPRT.png rename to textures/atlas/Atlas_Buildings_01.png diff --git a/textures/atlas/Buildings_All_01_SPRT.png.import b/textures/atlas/Atlas_Buildings_01.png.import similarity index 68% rename from textures/atlas/Buildings_All_01_SPRT.png.import rename to textures/atlas/Atlas_Buildings_01.png.import index a290ef1..0e02880 100644 --- a/textures/atlas/Buildings_All_01_SPRT.png.import +++ b/textures/atlas/Atlas_Buildings_01.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://f6v2cio41utg" -path="res://.godot/imported/Buildings_All_01_SPRT.png-548bc35a1ae9fb5b92ca7e066cf7ea8b.ctex" +path="res://.godot/imported/Atlas_Buildings_01.png-d949826ab6746fc19ccee1c6f2325521.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://textures/atlas/Buildings_All_01_SPRT.png" -dest_files=["res://.godot/imported/Buildings_All_01_SPRT.png-548bc35a1ae9fb5b92ca7e066cf7ea8b.ctex"] +source_file="res://textures/atlas/Atlas_Buildings_01.png" +dest_files=["res://.godot/imported/Atlas_Buildings_01.png-d949826ab6746fc19ccee1c6f2325521.ctex"] [params] diff --git a/textures/atlas/Builds_All_01_SPRT.png b/textures/atlas/Atlas_Builds_01.png similarity index 100% rename from textures/atlas/Builds_All_01_SPRT.png rename to textures/atlas/Atlas_Builds_01.png diff --git a/textures/atlas/Builds_All_01_SPRT.png.import b/textures/atlas/Atlas_Builds_01.png.import similarity index 69% rename from textures/atlas/Builds_All_01_SPRT.png.import rename to textures/atlas/Atlas_Builds_01.png.import index 752c709..a4ff320 100644 --- a/textures/atlas/Builds_All_01_SPRT.png.import +++ b/textures/atlas/Atlas_Builds_01.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://c4ne05d1pt7pq" -path="res://.godot/imported/Builds_All_01_SPRT.png-2ed7c6e63df1223c052a345af15ed928.ctex" +path="res://.godot/imported/Atlas_Builds_01.png-8a75d32443f29a658fa3274d878c39af.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://textures/atlas/Builds_All_01_SPRT.png" -dest_files=["res://.godot/imported/Builds_All_01_SPRT.png-2ed7c6e63df1223c052a345af15ed928.ctex"] +source_file="res://textures/atlas/Atlas_Builds_01.png" +dest_files=["res://.godot/imported/Atlas_Builds_01.png-8a75d32443f29a658fa3274d878c39af.ctex"] [params] diff --git a/textures/atlas/Builds_All_02_SPRT.png b/textures/atlas/Atlas_Builds_02.png similarity index 100% rename from textures/atlas/Builds_All_02_SPRT.png rename to textures/atlas/Atlas_Builds_02.png diff --git a/textures/atlas/Builds_All_02_SPRT.png.import b/textures/atlas/Atlas_Builds_02.png.import similarity index 69% rename from textures/atlas/Builds_All_02_SPRT.png.import rename to textures/atlas/Atlas_Builds_02.png.import index 1fe4115..09f5b53 100644 --- a/textures/atlas/Builds_All_02_SPRT.png.import +++ b/textures/atlas/Atlas_Builds_02.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://1hxeeioysqw0" -path="res://.godot/imported/Builds_All_02_SPRT.png-4d9a9adb06526004b7e92298c7b23d08.ctex" +path="res://.godot/imported/Atlas_Builds_02.png-dd9a77ef718fbdc267e864dc7b2ff573.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://textures/atlas/Builds_All_02_SPRT.png" -dest_files=["res://.godot/imported/Builds_All_02_SPRT.png-4d9a9adb06526004b7e92298c7b23d08.ctex"] +source_file="res://textures/atlas/Atlas_Builds_02.png" +dest_files=["res://.godot/imported/Atlas_Builds_02.png-dd9a77ef718fbdc267e864dc7b2ff573.ctex"] [params]