diff --git a/core/Cursor.tscn b/core/Cursor.tscn index f515579..ac17859 100644 --- a/core/Cursor.tscn +++ b/core/Cursor.tscn @@ -63,8 +63,8 @@ func pointcast(): CastResult = spaceState.direct_space_state.intersect_point(query) if ( (CastResult.size() > 0) and (old_result != CastResult) ): old_result = CastResult - if (CastResult.size()> 2): - breakpoint # should not detect multiple areas + #if (CastResult.size()> 2): + #breakpoint # should not detect multiple areas for _result in CastResult: if (_result.collider.input_pickable == true): selectedSticker = _result.collider.get_parent() diff --git a/maps/map1.tscn b/maps/map1.tscn index 415bea4..9be0aa6 100644 --- a/maps/map1.tscn +++ b/maps/map1.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=14 format=3 uid="uid://wlqsvbqpcbh"] +[gd_scene load_steps=21 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://cxharyv0ajr37" path="res://textures/atlas/DioramaEntrance_All_01_SPRT.png" id="2_n7y5f"] @@ -6,7 +6,9 @@ [ext_resource type="PackedScene" uid="uid://bddcriwo55x8k" path="res://prefab/prefab_woddenbridge.tscn" id="4_okpsn"] [ext_resource type="Texture2D" uid="uid://dx8jpmxtm2cdx" path="res://textures/pattern/Pattern_Forest.png" id="5_i137q"] [ext_resource type="Texture2D" uid="uid://cun14l52f477p" path="res://textures/atlas/Bushes_All_01_SPRT.png" id="5_xmosd"] -[ext_resource type="PackedScene" uid="uid://domcpxdf6lqpb" path="res://prefab/prefab_bush1.tscn" id="6_3fkbm"] +[ext_resource type="PackedScene" uid="uid://domcpxdf6lqpb" path="res://prefab/free_sticker.tscn" id="6_3fkbm"] +[ext_resource type="Texture2D" uid="uid://chuv25pm2vqen" path="res://textures/atlas/Rocks_All_01_SPRT.png" id="8_itp05"] +[ext_resource type="PackedScene" uid="uid://6ww1g2enfdx3" path="res://prefab/solid_sticker.tscn" id="9_nxjul"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_js06g"] @@ -27,8 +29,26 @@ atlas = ExtResource("5_xmosd") region = Rect2(736, 96, 224, 160) [sub_resource type="CapsuleShape2D" id="CapsuleShape2D_b3366"] -radius = 50.0 -height = 160.0 +radius = 70.08 +height = 150.2 + +[sub_resource type="AtlasTexture" id="AtlasTexture_vun1v"] +atlas = ExtResource("8_itp05") +region = Rect2(288, 256, 192, 160) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_4cdlc"] +size = Vector2(133.06, 62.73) + +[sub_resource type="AtlasTexture" id="AtlasTexture_wpoj4"] +atlas = ExtResource("8_itp05") +region = Rect2(1440, 1376, 256, 256) + +[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_bkpsv"] +radius = 115.4 +height = 230.8 + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_hk5e3"] +size = Vector2(201.89, 146.45) [node name="Map1" type="Node2D"] z_as_relative = false @@ -151,3 +171,23 @@ texture = SubResource("AtlasTexture_rn40i") offset = Vector2(-108.615, -141.38) Shape = SubResource("CapsuleShape2D_b3366") Position = Vector2(0, -48.95) + +[node name="Rock1" parent="." instance=ExtResource("9_nxjul")] +position = Vector2(-1807, 2030) +texture = SubResource("AtlasTexture_vun1v") +offset = Vector2(-78.385, -130.2) +StickerShape = SubResource("CapsuleShape2D_b3366") +Position = Vector2(8.56, -52.395) +CollisionShape = SubResource("RectangleShape2D_4cdlc") +CollisionPosition = Vector2(7.915, -31.39) +CollisionRotation = 0.0 + +[node name="Rock2" parent="." instance=ExtResource("9_nxjul")] +position = Vector2(-2248, 1895) +texture = SubResource("AtlasTexture_wpoj4") +offset = Vector2(-126.11, -220.56) +StickerShape = SubResource("CapsuleShape2D_bkpsv") +Position = Vector2(0, -89.75) +CollisionShape = SubResource("RectangleShape2D_hk5e3") +CollisionPosition = Vector2(0, -66.02) +CollisionRotation = 0.0 diff --git a/prefab/prefab_bush1.tscn b/prefab/free_sticker.tscn similarity index 82% rename from prefab/prefab_bush1.tscn rename to prefab/free_sticker.tscn index 7dcc58e..48984bb 100644 --- a/prefab/prefab_bush1.tscn +++ b/prefab/free_sticker.tscn @@ -10,7 +10,7 @@ region = Rect2(384, 64, 288, 224) script/source = "@tool extends Sprite2D -@export_group(\"Collision Shape\") +@export_group(\"Sticker Detection Shape\") @export var Shape :Shape2D: set(new_shape): Shape = new_shape @@ -26,22 +26,10 @@ extends Sprite2D Rotation = new_rotation $Area2D/CollisionShape2D.rotation = Rotation $Area2D/CollisionShape2D.queue_redraw() - -# Called when the node enters the scene tree for the first time. -func _ready(): - pass - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta): - pass - - - - + " -[node name="Bush1" type="Sprite2D"] +[node name="FreeSticker1" type="Sprite2D"] scale = Vector2(3.80334, 3.95089) texture = SubResource("AtlasTexture_2wdar") centered = false @@ -50,7 +38,8 @@ script = SubResource("GDScript_uqtu8") metadata/tags = ["sticker"] [node name="Area2D" type="Area2D" parent="."] -collision_layer = 3 +collision_layer = 2 +collision_mask = 0 monitoring = false [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] diff --git a/prefab/solid_sticker.tscn b/prefab/solid_sticker.tscn new file mode 100644 index 0000000..e351635 --- /dev/null +++ b/prefab/solid_sticker.tscn @@ -0,0 +1,79 @@ +[gd_scene load_steps=5 format=3 uid="uid://6ww1g2enfdx3"] + +[ext_resource type="Texture2D" uid="uid://cun14l52f477p" path="res://textures/atlas/Bushes_All_01_SPRT.png" id="1_ssqve"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_2wdar"] +atlas = ExtResource("1_ssqve") +region = Rect2(384, 64, 288, 224) + +[sub_resource type="GDScript" id="GDScript_uqtu8"] +script/source = "@tool +extends Sprite2D + +@export_group(\"Sticker Detection Shape\") +@export var StickerShape :Shape2D: + set(new_shape): + StickerShape = new_shape + $Area2D/StickerShape2D.shape = StickerShape + $Area2D/StickerShape2D.queue_redraw() +@export var Position :Vector2: + set(new_position): + Position = new_position + $Area2D/StickerShape2D.position = Position + $Area2D/StickerShape2D.queue_redraw() +@export var Rotation :Vector2: + set(new_rotation): + Rotation = new_rotation + $Area2D/StickerShape2D.rotation = Rotation + $Area2D/StickerShape2D.queue_redraw() + +@export_group(\"Collision Shape\") +@export var CollisionShape :Shape2D: + set(new_CollisionShape): + CollisionShape = new_CollisionShape + $StaticBody2D/CollisionShape2D.shape = CollisionShape + $StaticBody2D/CollisionShape2D.queue_redraw() +@export var CollisionPosition :Vector2: + set(new_CollisionPosition): + CollisionPosition = new_CollisionPosition + $StaticBody2D/CollisionShape2D.position = CollisionPosition + $StaticBody2D/CollisionShape2D.queue_redraw() +@export var CollisionRotation :float: + set(new_ColissionRotation): + CollisionRotation = new_ColissionRotation + $StaticBody2D/CollisionShape2D.rotation = CollisionRotation + $StaticBody2D/CollisionShape2D.queue_redraw() + +" + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_ep5ck"] +size = Vector2(104.391, 20.3774) + +[node name="SolidSticker1" type="Sprite2D"] +scale = Vector2(3.80334, 3.95089) +texture = SubResource("AtlasTexture_2wdar") +centered = false +offset = Vector2(-161.055, -179.785) +script = SubResource("GDScript_uqtu8") +CollisionPosition = null +CollisionRotation = null +metadata/tags = ["sticker"] + +[node name="Area2D" type="Area2D" parent="."] +collision_layer = 2 +collision_mask = 0 +monitoring = false + +[node name="StickerShape2D" type="CollisionShape2D" parent="Area2D"] +position = Vector2(-4.46976, -71.6294) +rotation = 1.5708 + +[node name="StaticBody2D" type="StaticBody2D" parent="."] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"] +position = Vector2(2.10341, -10.8836) +scale = Vector2(1, 1) +shape = SubResource("RectangleShape2D_ep5ck") +debug_color = Color(0.996033, 0, 0.194446, 0.42) + +[connection signal="property_list_changed" from="." to="." method="_on_property_list_changed"]