From b7defbb20926a0dd8bf9e845ebb152b3fc8392e9 Mon Sep 17 00:00:00 2001 From: Marco Date: Tue, 21 Jan 2025 15:17:26 +0100 Subject: [PATCH] Refactored locations --- Scenes/HUD/HUD.tscn | 11 +++++++++++ Scenes/{hud.tscn => HUD/oldhud.tscn} | 10 +++++----- Scenes/{ => Interactable}/Control_Pad.tscn | 0 Scenes/{ => Props}/Barrel.tscn | 2 +- Scenes/{ => Props}/Box_Red.tscn | 7 +++---- Scenes/{ => Props}/Box_Red_Broken.tscn | 0 Scenes/{ => Props}/Broken_Barrel.tscn | 0 Scenes/{Furniture => Props}/LargeTank.tscn | 11 ++++++----- .../{Furniture => Props}/MediumLiquidTank.tscn | 16 +++++++++++++++- Scenes/{Furniture => Props}/MediumTank.tscn | 0 Scenes/{Furniture => Props}/MediumTerminal.tscn | 14 +++++++++++++- Scenes/{ => Weapons}/bullet.tscn | 0 Scenes/{ => Weapons}/crosshair.tscn | 0 Scenes/player.tscn | 4 ++-- Scenes/test.tscn | 15 ++++++++------- Scripts/PlayerMovement.cs | 3 +-- 16 files changed, 65 insertions(+), 28 deletions(-) create mode 100644 Scenes/HUD/HUD.tscn rename Scenes/{hud.tscn => HUD/oldhud.tscn} (75%) rename Scenes/{ => Interactable}/Control_Pad.tscn (100%) rename Scenes/{ => Props}/Barrel.tscn (96%) rename Scenes/{ => Props}/Box_Red.tscn (92%) rename Scenes/{ => Props}/Box_Red_Broken.tscn (100%) rename Scenes/{ => Props}/Broken_Barrel.tscn (100%) rename Scenes/{Furniture => Props}/LargeTank.tscn (91%) rename Scenes/{Furniture => Props}/MediumLiquidTank.tscn (57%) rename Scenes/{Furniture => Props}/MediumTank.tscn (100%) rename Scenes/{Furniture => Props}/MediumTerminal.tscn (65%) rename Scenes/{ => Weapons}/bullet.tscn (100%) rename Scenes/{ => Weapons}/crosshair.tscn (100%) diff --git a/Scenes/HUD/HUD.tscn b/Scenes/HUD/HUD.tscn new file mode 100644 index 00000000..3491ad24 --- /dev/null +++ b/Scenes/HUD/HUD.tscn @@ -0,0 +1,11 @@ +[gd_scene load_steps=2 format=3 uid="uid://c567m475j0axf"] + +[ext_resource type="FontFile" uid="uid://ccm3u37q1hvux" path="res://fonts/Xolonium-Regular.ttf" id="1_ye2ho"] + +[node name="Hud" type="CanvasLayer"] + +[node name="HealthLabel" type="Label" parent="."] +offset_right = 40.0 +offset_bottom = 23.0 +theme_override_fonts/font = ExtResource("1_ye2ho") +text = "100" diff --git a/Scenes/hud.tscn b/Scenes/HUD/oldhud.tscn similarity index 75% rename from Scenes/hud.tscn rename to Scenes/HUD/oldhud.tscn index 625b6dca..ff3a1375 100644 --- a/Scenes/hud.tscn +++ b/Scenes/HUD/oldhud.tscn @@ -1,10 +1,10 @@ [gd_scene load_steps=3 format=3 uid="uid://dkwi1hu1bixoe"] -[ext_resource type="Script" path="res://Scripts/Hud.cs" id="1_4c8ar"] -[ext_resource type="FontFile" uid="uid://ccm3u37q1hvux" path="res://fonts/Xolonium-Regular.ttf" id="2_ip2r5"] +[ext_resource type="Script" path="res://Scripts/Hud.cs" id="1_m0hb0"] +[ext_resource type="FontFile" uid="uid://ccm3u37q1hvux" path="res://fonts/Xolonium-Regular.ttf" id="2_0xmx2"] [node name="HUD" type="CanvasLayer"] -script = ExtResource("1_4c8ar") +script = ExtResource("1_m0hb0") [node name="Health" type="Label" parent="."] anchors_preset = 2 @@ -13,7 +13,7 @@ anchor_bottom = 1.0 offset_top = -78.0 offset_right = 305.0 grow_vertical = 0 -theme_override_fonts/font = ExtResource("2_ip2r5") +theme_override_fonts/font = ExtResource("2_0xmx2") theme_override_font_sizes/font_size = 64 text = "100/100" @@ -29,7 +29,7 @@ offset_right = 217.0 offset_bottom = 39.0 grow_horizontal = 2 grow_vertical = 2 -theme_override_fonts/font = ExtResource("2_ip2r5") +theme_override_fonts/font = ExtResource("2_0xmx2") theme_override_font_sizes/font_size = 64 text = "GAME OVER" diff --git a/Scenes/Control_Pad.tscn b/Scenes/Interactable/Control_Pad.tscn similarity index 100% rename from Scenes/Control_Pad.tscn rename to Scenes/Interactable/Control_Pad.tscn diff --git a/Scenes/Barrel.tscn b/Scenes/Props/Barrel.tscn similarity index 96% rename from Scenes/Barrel.tscn rename to Scenes/Props/Barrel.tscn index 6ef190d3..41ed0c5c 100644 --- a/Scenes/Barrel.tscn +++ b/Scenes/Props/Barrel.tscn @@ -2,7 +2,7 @@ [ext_resource type="Script" path="res://Scenes/Barrel.cs" id="1_avwdx"] [ext_resource type="Texture2D" uid="uid://d2f16ke8c7vwx" path="res://Sprites/Barrel.png" id="1_e66t6"] -[ext_resource type="PackedScene" uid="uid://clyyl3jgpfoo7" path="res://Scenes/Broken_Barrel.tscn" id="2_f145b"] +[ext_resource type="PackedScene" uid="uid://clyyl3jgpfoo7" path="res://Scenes/Props/Broken_Barrel.tscn" id="2_f145b"] [ext_resource type="PackedScene" uid="uid://jmijre3eaf8m" path="res://Scenes/Explosion.tscn" id="3_sm378"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_2ewfl"] diff --git a/Scenes/Box_Red.tscn b/Scenes/Props/Box_Red.tscn similarity index 92% rename from Scenes/Box_Red.tscn rename to Scenes/Props/Box_Red.tscn index 1f054db3..999a82ec 100644 --- a/Scenes/Box_Red.tscn +++ b/Scenes/Props/Box_Red.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=7 format=3 uid="uid://bgk7fgwiis425"] [ext_resource type="Script" path="res://Scenes/Barrel.cs" id="1_flhlf"] -[ext_resource type="PackedScene" uid="uid://dpaobtgb3l4ft" path="res://Scenes/Box_Red_Broken.tscn" id="2_baxfl"] +[ext_resource type="PackedScene" uid="uid://dpaobtgb3l4ft" path="res://Scenes/Props/Box_Red_Broken.tscn" id="2_baxfl"] [ext_resource type="Texture2D" uid="uid://c1djpk8lbgjfe" path="res://Sprites/Box_Red.png" id="2_g1pum"] [ext_resource type="PackedScene" uid="uid://jmijre3eaf8m" path="res://Scenes/Explosion.tscn" id="3_mbs7l"] @@ -9,7 +9,7 @@ size = Vector2(11, 14) [sub_resource type="RectangleShape2D" id="RectangleShape2D_ss2y0"] -size = Vector2(11, 14) +size = Vector2(12, 10) [node name="Red Box" type="Area2D" groups=["Destroyable"]] collision_layer = 64 @@ -36,6 +36,5 @@ collision_mask = 10 gravity_scale = 0.0 [node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"] -visible = false -position = Vector2(0.5, -1) +position = Vector2(0, -3) shape = SubResource("RectangleShape2D_ss2y0") diff --git a/Scenes/Box_Red_Broken.tscn b/Scenes/Props/Box_Red_Broken.tscn similarity index 100% rename from Scenes/Box_Red_Broken.tscn rename to Scenes/Props/Box_Red_Broken.tscn diff --git a/Scenes/Broken_Barrel.tscn b/Scenes/Props/Broken_Barrel.tscn similarity index 100% rename from Scenes/Broken_Barrel.tscn rename to Scenes/Props/Broken_Barrel.tscn diff --git a/Scenes/Furniture/LargeTank.tscn b/Scenes/Props/LargeTank.tscn similarity index 91% rename from Scenes/Furniture/LargeTank.tscn rename to Scenes/Props/LargeTank.tscn index 8782e1c4..66747e5e 100644 --- a/Scenes/Furniture/LargeTank.tscn +++ b/Scenes/Props/LargeTank.tscn @@ -13,11 +13,11 @@ region = Rect2(0, 0, 64, 64) size = Vector2(61, 61) [sub_resource type="RectangleShape2D" id="RectangleShape2D_s3n6b"] -size = Vector2(60, 57) +size = Vector2(54, 48) [node name="LargeTank" type="Area2D"] -collision_layer = 65 -collision_mask = 11 +collision_layer = 64 +collision_mask = 10 script = ExtResource("1_7ckvo") Health = 4.0 DebrisScene = ExtResource("2_wpybp") @@ -32,8 +32,9 @@ position = Vector2(0.5, -0.5) shape = SubResource("RectangleShape2D_0nhpj") [node name="RigidBody2D" type="RigidBody2D" parent="."] -visible = false +collision_layer = 64 +collision_mask = 10 [node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"] -position = Vector2(0, 1.5) +position = Vector2(0, -3) shape = SubResource("RectangleShape2D_s3n6b") diff --git a/Scenes/Furniture/MediumLiquidTank.tscn b/Scenes/Props/MediumLiquidTank.tscn similarity index 57% rename from Scenes/Furniture/MediumLiquidTank.tscn rename to Scenes/Props/MediumLiquidTank.tscn index ed780ea3..b2eeee26 100644 --- a/Scenes/Furniture/MediumLiquidTank.tscn +++ b/Scenes/Props/MediumLiquidTank.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=5 format=3 uid="uid://7cpk3c3d8cl7"] +[gd_scene load_steps=7 format=3 uid="uid://7cpk3c3d8cl7"] [ext_resource type="Script" path="res://Scenes/Barrel.cs" id="1_laidj"] [ext_resource type="Texture2D" uid="uid://dqx1di84tkfft" path="res://Sprites/MediumLiquidTanks.png" id="1_mv1jg"] +[ext_resource type="PackedScene" uid="uid://jmijre3eaf8m" path="res://Scenes/Explosion.tscn" id="2_1wfyv"] [sub_resource type="AtlasTexture" id="AtlasTexture_i3nxh"] atlas = ExtResource("1_mv1jg") @@ -10,11 +11,15 @@ region = Rect2(64, 96, 32, 32) [sub_resource type="RectangleShape2D" id="RectangleShape2D_0nhpj"] size = Vector2(28, 24) +[sub_resource type="RectangleShape2D" id="RectangleShape2D_b7nn4"] +size = Vector2(24, 14) + [node name="LargeTank" type="Area2D"] collision_layer = 64 collision_mask = 10 script = ExtResource("1_laidj") Health = 2.0 +ExplosionParticles = ExtResource("2_1wfyv") metadata/_edit_group_ = true [node name="Sprite2D" type="Sprite2D" parent="."] @@ -23,3 +28,12 @@ texture = SubResource("AtlasTexture_i3nxh") [node name="CollisionShape2D" type="CollisionShape2D" parent="."] visible = false shape = SubResource("RectangleShape2D_0nhpj") + +[node name="RigidBody2D" type="RigidBody2D" parent="."] +collision_layer = 64 +collision_mask = 10 +gravity_scale = 0.0 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"] +position = Vector2(0, -3) +shape = SubResource("RectangleShape2D_b7nn4") diff --git a/Scenes/Furniture/MediumTank.tscn b/Scenes/Props/MediumTank.tscn similarity index 100% rename from Scenes/Furniture/MediumTank.tscn rename to Scenes/Props/MediumTank.tscn diff --git a/Scenes/Furniture/MediumTerminal.tscn b/Scenes/Props/MediumTerminal.tscn similarity index 65% rename from Scenes/Furniture/MediumTerminal.tscn rename to Scenes/Props/MediumTerminal.tscn index e1600fc9..b807a95b 100644 --- a/Scenes/Furniture/MediumTerminal.tscn +++ b/Scenes/Props/MediumTerminal.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=5 format=3 uid="uid://bnhck5eh0tqxf"] +[gd_scene load_steps=6 format=3 uid="uid://bnhck5eh0tqxf"] [ext_resource type="Script" path="res://Scenes/Barrel.cs" id="1_iba8l"] [ext_resource type="Texture2D" uid="uid://juyup7so2u4g" path="res://Sprites/MediumTerminals.png" id="1_sgrg1"] @@ -10,6 +10,9 @@ region = Rect2(96, 0, 32, 32) [sub_resource type="RectangleShape2D" id="RectangleShape2D_0nhpj"] size = Vector2(28, 24) +[sub_resource type="RectangleShape2D" id="RectangleShape2D_vguns"] +size = Vector2(26, 22) + [node name="LargeTank" type="Area2D" groups=["Destroyable"]] collision_layer = 64 collision_mask = 10 @@ -22,3 +25,12 @@ texture = SubResource("AtlasTexture_i3nxh") [node name="CollisionShape2D" type="CollisionShape2D" parent="."] visible = false shape = SubResource("RectangleShape2D_0nhpj") + +[node name="RigidBody2D" type="RigidBody2D" parent="."] +collision_layer = 64 +collision_mask = 10 +gravity_scale = 0.0 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"] +position = Vector2(1, -4) +shape = SubResource("RectangleShape2D_vguns") diff --git a/Scenes/bullet.tscn b/Scenes/Weapons/bullet.tscn similarity index 100% rename from Scenes/bullet.tscn rename to Scenes/Weapons/bullet.tscn diff --git a/Scenes/crosshair.tscn b/Scenes/Weapons/crosshair.tscn similarity index 100% rename from Scenes/crosshair.tscn rename to Scenes/Weapons/crosshair.tscn diff --git a/Scenes/player.tscn b/Scenes/player.tscn index a18a24e3..667d7279 100644 --- a/Scenes/player.tscn +++ b/Scenes/player.tscn @@ -2,11 +2,11 @@ [ext_resource type="Script" path="res://Scripts/PlayerMovement.cs" id="1_m27vu"] [ext_resource type="Texture2D" uid="uid://la06powu57hu" path="res://Sprites/Cirno_Big.png" id="2_bwf6x"] -[ext_resource type="PackedScene" uid="uid://b1qnfiuokpvsr" path="res://Scenes/bullet.tscn" id="2_ov36d"] +[ext_resource type="PackedScene" uid="uid://b1qnfiuokpvsr" path="res://Scenes/Weapons/bullet.tscn" id="2_ov36d"] [ext_resource type="PackedScene" uid="uid://chkpk7erlqajg" path="res://Scenes/Selector.tscn" id="3_8wt6s"] [ext_resource type="Script" path="res://addons/smoothing/smoothing_2d.gd" id="4_j4xhu"] [ext_resource type="Script" path="res://Scenes/CameraTarget.gd" id="5_cxvyt"] -[ext_resource type="PackedScene" uid="uid://cfb3nsay84xdb" path="res://Scenes/crosshair.tscn" id="6_l43rf"] +[ext_resource type="PackedScene" uid="uid://cfb3nsay84xdb" path="res://Scenes/Weapons/crosshair.tscn" id="6_l43rf"] [ext_resource type="Script" path="res://Scenes/InteractionController.cs" id="7_uvgjg"] [ext_resource type="PackedScene" uid="uid://crry0rgk7a8sm" path="res://Scenes/Weapons/BaseWeapon.tscn" id="9_wblq0"] diff --git a/Scenes/test.tscn b/Scenes/test.tscn index 890f8c03..dbeb9110 100644 --- a/Scenes/test.tscn +++ b/Scenes/test.tscn @@ -2,18 +2,18 @@ [ext_resource type="PackedScene" uid="uid://bghghp5ep4w2j" path="res://Scenes/player.tscn" id="2_8mh54"] [ext_resource type="PackedScene" uid="uid://rp4jhx0tuh24" path="res://Scenes/fragola.tscn" id="4_s7wq6"] -[ext_resource type="PackedScene" uid="uid://bj28qiai2x2ar" path="res://Scenes/Barrel.tscn" id="5_3uba3"] -[ext_resource type="PackedScene" uid="uid://uaf5r6cd71hu" path="res://Scenes/Furniture/LargeTank.tscn" id="6_nkauc"] +[ext_resource type="PackedScene" uid="uid://bj28qiai2x2ar" path="res://Scenes/Props/Barrel.tscn" id="5_3uba3"] +[ext_resource type="PackedScene" uid="uid://uaf5r6cd71hu" path="res://Scenes/Props/LargeTank.tscn" id="6_nkauc"] [ext_resource type="Script" path="res://Scenes/CameraController.gd" id="6_t8ide"] -[ext_resource type="PackedScene" uid="uid://crmwuwhltmdq7" path="res://Scenes/Furniture/MediumTank.tscn" id="7_lmrl1"] +[ext_resource type="PackedScene" uid="uid://crmwuwhltmdq7" path="res://Scenes/Props/MediumTank.tscn" id="7_lmrl1"] [ext_resource type="Texture2D" uid="uid://tphqodqyere1" path="res://Tilesets/factory.png" id="8_0km4o"] -[ext_resource type="PackedScene" uid="uid://7cpk3c3d8cl7" path="res://Scenes/Furniture/MediumLiquidTank.tscn" id="8_2wpw7"] +[ext_resource type="PackedScene" uid="uid://7cpk3c3d8cl7" path="res://Scenes/Props/MediumLiquidTank.tscn" id="8_2wpw7"] [ext_resource type="PackedScene" uid="uid://byms2dhliyux0" path="res://Scenes/teleporter.tscn" id="10_mc6y5"] -[ext_resource type="PackedScene" uid="uid://crph24e6e0v0q" path="res://Scenes/Control_Pad.tscn" id="12_hfkf1"] +[ext_resource type="PackedScene" uid="uid://crph24e6e0v0q" path="res://Scenes/Interactable/Control_Pad.tscn" id="12_hfkf1"] [ext_resource type="PackedScene" uid="uid://l84on3kv2s52" path="res://Scenes/Door_Horizontal.tscn" id="12_i7i2m"] -[ext_resource type="PackedScene" uid="uid://bnhck5eh0tqxf" path="res://Scenes/Furniture/MediumTerminal.tscn" id="13_acrmt"] +[ext_resource type="PackedScene" uid="uid://bnhck5eh0tqxf" path="res://Scenes/Props/MediumTerminal.tscn" id="13_acrmt"] [ext_resource type="PackedScene" uid="uid://bqq3q37hugdlj" path="res://Scenes/Door.tscn" id="14_y363m"] -[ext_resource type="PackedScene" uid="uid://bgk7fgwiis425" path="res://Scenes/Box_Red.tscn" id="15_m0y0j"] +[ext_resource type="PackedScene" uid="uid://bgk7fgwiis425" path="res://Scenes/Props/Box_Red.tscn" id="15_m0y0j"] [ext_resource type="PackedScene" uid="uid://bc64lr3vlwchq" path="res://Scenes/Door_Vertical.tscn" id="15_mgtvp"] [ext_resource type="PackedScene" uid="uid://cxjumgf8bhr3l" path="res://Scenes/Elevator.tscn" id="16_n40rt"] [ext_resource type="Script" path="res://Scripts/InventoryManager.cs" id="18_dvo37"] @@ -349,3 +349,4 @@ position = Vector2(-1164, 208) [node name="KeycardPad" parent="." node_paths=PackedStringArray("Target") instance=ExtResource("20_0aphx")] position = Vector2(-1094, 135) Target = NodePath("../Factory Tilemaps/HorizontalDoor") +RequiresKeycard = false diff --git a/Scripts/PlayerMovement.cs b/Scripts/PlayerMovement.cs index 317ac563..4414a5fd 100644 --- a/Scripts/PlayerMovement.cs +++ b/Scripts/PlayerMovement.cs @@ -35,8 +35,7 @@ public partial class PlayerMovement : CharacterBody2D, IDestructible [Export] public float Health = 4f; [Export] public Weapon EquippedWeapon; - - [DebugGUIPrint] + private float _currentHealth = 0f; private bool _isDestroyed = false;