mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-10 17:05:54 +00:00
Multicolored keycards
This commit is contained in:
parent
ad985ce1ac
commit
5110cace07
17 changed files with 273 additions and 22 deletions
9
Resources/Items/Blue_Keycard.tres
Normal file
9
Resources/Items/Blue_Keycard.tres
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[gd_resource type="Resource" script_class="LootItem" load_steps=2 format=3 uid="uid://cj5aa7btaw6q0"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/LootItem.cs" id="1_k8cnp"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_k8cnp")
|
||||
Item = 1
|
||||
Amount = 1
|
||||
Max = 1
|
||||
9
Resources/Items/Green_Keycard.tres
Normal file
9
Resources/Items/Green_Keycard.tres
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[gd_resource type="Resource" script_class="LootItem" load_steps=2 format=3 uid="uid://cspcgkr0tane2"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/LootItem.cs" id="1_t0s5w"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_t0s5w")
|
||||
Item = 2
|
||||
Amount = 1
|
||||
Max = 1
|
||||
33
Scenes/Items/Blue_Keycard.tscn
Normal file
33
Scenes/Items/Blue_Keycard.tscn
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://d0yes7huiyisw"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dxs3ks2ucaxl4" path="res://Scenes/Items/Red_Keycard.tscn" id="1_8f4hq"]
|
||||
[ext_resource type="Resource" uid="uid://cj5aa7btaw6q0" path="res://Resources/Items/Blue_Keycard.tres" id="2_woclw"]
|
||||
[ext_resource type="Texture2D" uid="uid://bvybqletsvqgk" path="res://Sprites/Items/BlueKeycard_Small.png" id="3_k20dr"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_kprwo"]
|
||||
atlas = ExtResource("3_k20dr")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_kems3"]
|
||||
atlas = ExtResource("3_k20dr")
|
||||
region = Rect2(16, 0, 16, 16)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_gbw5v"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_kprwo")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_kems3")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[node name="BlueKeycard" instance=ExtResource("1_8f4hq")]
|
||||
LootTable = [ExtResource("2_woclw")]
|
||||
|
||||
[node name="AnimatedSprite2D" parent="." index="1"]
|
||||
sprite_frames = SubResource("SpriteFrames_gbw5v")
|
||||
31
Scenes/Items/Green_Keycard.tscn
Normal file
31
Scenes/Items/Green_Keycard.tscn
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://r25rq6ijgm6m"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dxs3ks2ucaxl4" path="res://Scenes/Items/Red_Keycard.tscn" id="1_o26qb"]
|
||||
[ext_resource type="Texture2D" uid="uid://bvkjnc3ggp7ba" path="res://Sprites/Items/GreenKeycard_Small.png" id="2_lts72"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_3c71u"]
|
||||
atlas = ExtResource("2_lts72")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_tdlc7"]
|
||||
atlas = ExtResource("2_lts72")
|
||||
region = Rect2(16, 0, 16, 16)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_y8q6b"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_3c71u")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_tdlc7")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[node name="GreenKeyCard" instance=ExtResource("1_o26qb")]
|
||||
|
||||
[node name="AnimatedSprite2D" parent="." index="1"]
|
||||
sprite_frames = SubResource("SpriteFrames_y8q6b")
|
||||
41
Scenes/Items/Red_Keycard.tscn
Normal file
41
Scenes/Items/Red_Keycard.tscn
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://dxs3ks2ucaxl4"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Interactables/ItemPickup.cs" id="1_cvvxn"]
|
||||
[ext_resource type="Resource" uid="uid://dibquna7fww7t" path="res://Resources/Items/Red_Keycard.tres" id="4_84krq"]
|
||||
[ext_resource type="Texture2D" uid="uid://bad6gbl2gity3" path="res://Sprites/Items/RedKeycard_Small.png" id="4_k5oc1"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_6vv2s"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_o0au0"]
|
||||
atlas = ExtResource("4_k5oc1")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_fx6tu"]
|
||||
atlas = ExtResource("4_k5oc1")
|
||||
region = Rect2(16, 0, 16, 16)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_vi6i0"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_o0au0")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_fx6tu")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[node name="RedKeyCard" type="Area2D" groups=["Interactable"]]
|
||||
collision_layer = 4
|
||||
collision_mask = 2
|
||||
script = ExtResource("1_cvvxn")
|
||||
LootTable = [ExtResource("4_84krq")]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_6vv2s")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
sprite_frames = SubResource("SpriteFrames_vi6i0")
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://dxs3ks2ucaxl4"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scenes/Interactable.cs" id="1_8ev2v"]
|
||||
[ext_resource type="Texture2D" uid="uid://c53bchw2krocb" path="res://Sprites/Red_Keycard.png" id="2_onmup"]
|
||||
[ext_resource type="Script" path="res://Scripts/Pickupper.cs" id="3_t6rqq"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_x0adl"]
|
||||
|
||||
[node name="ControlPad" type="Area2D" groups=["Interactable"]]
|
||||
collision_layer = 4
|
||||
collision_mask = 2
|
||||
script = ExtResource("1_8ev2v")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_x0adl")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture = ExtResource("2_onmup")
|
||||
|
||||
[node name="Pickupper" type="Node2D" parent="."]
|
||||
script = ExtResource("3_t6rqq")
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
[ext_resource type="Script" path="res://Scripts/InventoryManager.cs" id="18_dvo37"]
|
||||
[ext_resource type="PackedScene" uid="uid://v8s3kubgb2qg" path="res://Scenes/Enemy.tscn" id="18_ixcwn"]
|
||||
[ext_resource type="Resource" uid="uid://dibquna7fww7t" path="res://Resources/Items/Red_Keycard.tres" id="18_t6ass"]
|
||||
[ext_resource type="PackedScene" uid="uid://dxs3ks2ucaxl4" path="res://Scenes/Red_Keycard.tscn" id="19_8fb73"]
|
||||
[ext_resource type="PackedScene" uid="uid://dxs3ks2ucaxl4" path="res://Scenes/Items/Red_Keycard.tscn" id="19_8fb73"]
|
||||
[ext_resource type="PackedScene" uid="uid://dkwi1hu1bixoe" path="res://Scenes/HUD/HUD.tscn" id="22_krk0o"]
|
||||
[ext_resource type="Script" path="res://Scenes/CameraTarget.gd" id="24_0c2yt"]
|
||||
[ext_resource type="PackedScene" uid="uid://djf0y08ix66fn" path="res://Scenes/Interactable/Chest.tscn" id="25_4b2ed"]
|
||||
|
|
@ -444,3 +444,6 @@ script = ExtResource("24_0c2yt")
|
|||
|
||||
[node name="PlayerStartPosition" type="Marker2D" parent="."]
|
||||
position = Vector2(-790, -161)
|
||||
|
||||
[node name="RedKeyCard2" parent="." instance=ExtResource("19_8fb73")]
|
||||
position = Vector2(-824, -152)
|
||||
|
|
|
|||
26
Scripts/Interactables/ItemPickup.cs
Normal file
26
Scripts/Interactables/ItemPickup.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
using Cirno.Scripts.Resources;
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace Cirno.Scripts.Interactables;
|
||||
|
||||
public partial class ItemPickup : Interactable
|
||||
{
|
||||
[Export] public Array<LootItem> LootTable = new Array<LootItem>();
|
||||
|
||||
public override bool Activate()
|
||||
{
|
||||
GD.Print("Attempting to Pickup Item");
|
||||
|
||||
if (!MeetsRequirements()) return false;
|
||||
foreach (var item in LootTable)
|
||||
{
|
||||
_inventoryManager.AddItem(item.Item, item.Amount);
|
||||
}
|
||||
|
||||
// Delet This
|
||||
QueueFree();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
BIN
Sprites/Items/BlueKeycard_Small.aseprite
(Stored with Git LFS)
Normal file
BIN
Sprites/Items/BlueKeycard_Small.aseprite
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Sprites/Items/BlueKeycard_Small.png
(Stored with Git LFS)
Normal file
BIN
Sprites/Items/BlueKeycard_Small.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
Sprites/Items/BlueKeycard_Small.png.import
Normal file
34
Sprites/Items/BlueKeycard_Small.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bvybqletsvqgk"
|
||||
path="res://.godot/imported/BlueKeycard_Small.png-b925d0e80a2eaa9ef7fe1ee182ce6c65.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/Items/BlueKeycard_Small.png"
|
||||
dest_files=["res://.godot/imported/BlueKeycard_Small.png-b925d0e80a2eaa9ef7fe1ee182ce6c65.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
|
||||
BIN
Sprites/Items/GreenKeycard_Small.aseprite
(Stored with Git LFS)
Normal file
BIN
Sprites/Items/GreenKeycard_Small.aseprite
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Sprites/Items/GreenKeycard_Small.png
(Stored with Git LFS)
Normal file
BIN
Sprites/Items/GreenKeycard_Small.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
Sprites/Items/GreenKeycard_Small.png.import
Normal file
34
Sprites/Items/GreenKeycard_Small.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bvkjnc3ggp7ba"
|
||||
path="res://.godot/imported/GreenKeycard_Small.png-a8d591427ed9e736d5a900d3111dd142.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/Items/GreenKeycard_Small.png"
|
||||
dest_files=["res://.godot/imported/GreenKeycard_Small.png-a8d591427ed9e736d5a900d3111dd142.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
|
||||
BIN
Sprites/Items/RedKeycard_Small.aseprite
(Stored with Git LFS)
Normal file
BIN
Sprites/Items/RedKeycard_Small.aseprite
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Sprites/Items/RedKeycard_Small.png
(Stored with Git LFS)
Normal file
BIN
Sprites/Items/RedKeycard_Small.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
Sprites/Items/RedKeycard_Small.png.import
Normal file
34
Sprites/Items/RedKeycard_Small.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bad6gbl2gity3"
|
||||
path="res://.godot/imported/RedKeycard_Small.png-11803ebfee263388f1f5d2bd1a970e0e.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/Items/RedKeycard_Small.png"
|
||||
dest_files=["res://.godot/imported/RedKeycard_Small.png-11803ebfee263388f1f5d2bd1a970e0e.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