mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 08:45:33 +00:00
Interactable Chest Collision
This commit is contained in:
parent
b645e1724e
commit
686dea6c8d
8 changed files with 95 additions and 22 deletions
|
|
@ -5,6 +5,9 @@
|
|||
[ext_resource type="Script" path="res://Scripts/Pickupper.cs" id="3_qro6k"]
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/LootItem.cs" id="4_rcd61"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_ihal6"]
|
||||
radius = 16.0
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_elja3"]
|
||||
atlas = ExtResource("2_w7a1a")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
|
@ -70,9 +73,6 @@ animations = [{
|
|||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_ihal6"]
|
||||
radius = 16.0
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_isrvb"]
|
||||
size = Vector2(12, 10)
|
||||
|
||||
|
|
@ -81,19 +81,19 @@ script = ExtResource("4_rcd61")
|
|||
Item = 3
|
||||
Amount = 10
|
||||
|
||||
[node name="Chest" type="Node2D"]
|
||||
[node name="Chest" type="Area2D" node_paths=PackedStringArray("Target") groups=["Interactable"]]
|
||||
collision_layer = 4
|
||||
collision_mask = 2
|
||||
script = ExtResource("1_4p5d3")
|
||||
Target = NodePath("Pickupper")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_ihal6")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
sprite_frames = SubResource("SpriteFrames_cirgn")
|
||||
animation = &"Closed"
|
||||
|
||||
[node name="Interactable" type="Area2D" parent="." node_paths=PackedStringArray("Target") groups=["Interactable"]]
|
||||
script = ExtResource("1_4p5d3")
|
||||
Target = NodePath("../Pickupper")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Interactable"]
|
||||
shape = SubResource("CircleShape2D_ihal6")
|
||||
|
||||
[node name="RigidBody2D" type="RigidBody2D" parent="."]
|
||||
collision_layer = 64
|
||||
collision_mask = 10
|
||||
|
|
|
|||
|
|
@ -1,8 +1,33 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://chkpk7erlqajg"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://chkpk7erlqajg"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://kgs1d0m47u3g" path="res://Sprites/selector.png" id="1_ui0xt"]
|
||||
[ext_resource type="Texture2D" uid="uid://dde36pgb8fbwc" path="res://Sprites/selector_big.png" id="1_cc7mb"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_gc2o5"]
|
||||
atlas = ExtResource("1_cc7mb")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_goaai"]
|
||||
atlas = ExtResource("1_cc7mb")
|
||||
region = Rect2(16, 0, 16, 16)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_kehny"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_gc2o5")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_goaai")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[node name="Selector" type="Node2D"]
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture = ExtResource("1_ui0xt")
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
z_index = -5
|
||||
sprite_frames = SubResource("SpriteFrames_kehny")
|
||||
frame = 1
|
||||
frame_progress = 0.18995
|
||||
|
|
|
|||
|
|
@ -377,6 +377,12 @@ position = Vector2(-1120, 128)
|
|||
[node name="HorizontalDoor2" parent="Factory Tilemaps" instance=ExtResource("12_i7i2m")]
|
||||
position = Vector2(-944, 160)
|
||||
|
||||
[node name="Chest" parent="Factory Tilemaps" instance=ExtResource("25_4b2ed")]
|
||||
position = Vector2(-760, -169)
|
||||
|
||||
[node name="ControlPad5" parent="Factory Tilemaps" instance=ExtResource("12_hfkf1")]
|
||||
position = Vector2(-791, -137)
|
||||
|
||||
[node name="CameraController" type="Camera2D" parent="."]
|
||||
script = ExtResource("6_t8ide")
|
||||
pixel_snap = false
|
||||
|
|
@ -432,6 +438,3 @@ script = ExtResource("24_0c2yt")
|
|||
|
||||
[node name="PlayerStartPosition" type="Marker2D" parent="."]
|
||||
position = Vector2(-779, -160)
|
||||
|
||||
[node name="Chest" parent="." instance=ExtResource("25_4b2ed")]
|
||||
position = Vector2(-760, -169)
|
||||
|
|
|
|||
|
|
@ -88,8 +88,8 @@ public partial class PlayerMovement : CharacterBody2D, IDestructible
|
|||
|
||||
if (SelectorScene != null)
|
||||
{
|
||||
_selector = this.CreateChild<Node2D>(SelectorScene);
|
||||
_selector.Visible = false;
|
||||
_selector = this.CreateSibling<Node2D>(SelectorScene, this.GlobalPosition);
|
||||
_selector.Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -257,7 +257,7 @@ public partial class PlayerMovement : CharacterBody2D, IDestructible
|
|||
// Replace with function body.
|
||||
if (area.IsInGroup("Interactable") && area is Interactable interactable)
|
||||
{
|
||||
Debug.WriteLine("Interactable Entered");
|
||||
Debug.WriteLine($"Interactable {area.Name} Entered");
|
||||
|
||||
if (_selector != null)
|
||||
{
|
||||
|
|
@ -268,6 +268,11 @@ public partial class PlayerMovement : CharacterBody2D, IDestructible
|
|||
}
|
||||
}
|
||||
|
||||
private void _on_interaction_controller_area_exited(Area2D area)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void Explode()
|
||||
{
|
||||
Debug.WriteLine("Ded");
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public static class Tools
|
|||
|
||||
public static T CreateSibling<T>(this Node2D node, PackedScene prefab) where T : Node2D
|
||||
{
|
||||
return CreateSibling<T>(node, prefab, node.GlobalPosition);
|
||||
return CreateChildOf<T>(node, node.GetParent<Node2D>(), prefab, node.GlobalPosition);
|
||||
}
|
||||
|
||||
public static T CreateSibling<T>(this Node2D node, PackedScene prefab, Vector2 position) where T : Node2D
|
||||
|
|
|
|||
BIN
Sprites/selector_big.aseprite
(Stored with Git LFS)
Normal file
BIN
Sprites/selector_big.aseprite
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Sprites/selector_big.png
(Stored with Git LFS)
Normal file
BIN
Sprites/selector_big.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
Sprites/selector_big.png.import
Normal file
34
Sprites/selector_big.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dde36pgb8fbwc"
|
||||
path="res://.godot/imported/selector_big.png-27577e86fb500a19a8e9ac34042c9f91.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/selector_big.png"
|
||||
dest_files=["res://.godot/imported/selector_big.png-27577e86fb500a19a8e9ac34042c9f91.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
Loading…
Add table
Add a link
Reference in a new issue