Alarm box

This commit is contained in:
Marco 2025-02-04 13:22:05 +01:00
commit 60dad2d002
15 changed files with 581 additions and 401 deletions

View file

@ -1,293 +1,49 @@
[gd_scene load_steps=38 format=3 uid="uid://c27co22bjym3c"]
[gd_scene load_steps=7 format=3 uid="uid://c27co22bjym3c"]
[ext_resource type="Script" path="res://Scripts/Actors/Camera.cs" id="1_2qb38"]
[ext_resource type="Texture2D" uid="uid://cpuffmksk41n4" path="res://Sprites/Actors/Camera.png" id="1_l5lfg"]
[sub_resource type="AtlasTexture" id="AtlasTexture_1cxu1"]
atlas = ExtResource("1_l5lfg")
region = Rect2(32, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_bi4kn"]
atlas = ExtResource("1_l5lfg")
region = Rect2(16, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_qgntu"]
atlas = ExtResource("1_l5lfg")
region = Rect2(0, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_0xn7d"]
atlas = ExtResource("1_l5lfg")
region = Rect2(32, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_5xbm6"]
atlas = ExtResource("1_l5lfg")
region = Rect2(48, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_oxghg"]
atlas = ExtResource("1_l5lfg")
region = Rect2(64, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_6e5gf"]
atlas = ExtResource("1_l5lfg")
region = Rect2(32, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_dxl8p"]
atlas = ExtResource("1_l5lfg")
region = Rect2(0, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_d0i3t"]
atlas = ExtResource("1_l5lfg")
region = Rect2(16, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_oy0eq"]
atlas = ExtResource("1_l5lfg")
region = Rect2(32, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_14w2k"]
atlas = ExtResource("1_l5lfg")
region = Rect2(48, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_m2si1"]
atlas = ExtResource("1_l5lfg")
region = Rect2(64, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_lbhml"]
atlas = ExtResource("1_l5lfg")
region = Rect2(64, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_rw7h1"]
atlas = ExtResource("1_l5lfg")
region = Rect2(48, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_x62ns"]
atlas = ExtResource("1_l5lfg")
region = Rect2(32, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_unrcw"]
atlas = ExtResource("1_l5lfg")
region = Rect2(16, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_y5qth"]
atlas = ExtResource("1_l5lfg")
region = Rect2(0, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_qkmcw"]
atlas = ExtResource("1_l5lfg")
region = Rect2(0, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_myuwn"]
atlas = ExtResource("1_l5lfg")
region = Rect2(16, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_8aa11"]
atlas = ExtResource("1_l5lfg")
region = Rect2(32, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_u7xyi"]
atlas = ExtResource("1_l5lfg")
region = Rect2(0, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_qrkj0"]
atlas = ExtResource("1_l5lfg")
region = Rect2(16, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_qcqm5"]
atlas = ExtResource("1_l5lfg")
region = Rect2(32, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_34faw"]
atlas = ExtResource("1_l5lfg")
region = Rect2(48, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_j34h0"]
atlas = ExtResource("1_l5lfg")
region = Rect2(64, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_ojvts"]
atlas = ExtResource("1_l5lfg")
region = Rect2(64, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_kf402"]
atlas = ExtResource("1_l5lfg")
region = Rect2(48, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_aaebm"]
atlas = ExtResource("1_l5lfg")
region = Rect2(32, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_owve1"]
atlas = ExtResource("1_l5lfg")
region = Rect2(64, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_0eww4"]
atlas = ExtResource("1_l5lfg")
region = Rect2(48, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_0pie4"]
atlas = ExtResource("1_l5lfg")
region = Rect2(32, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_oh7bx"]
atlas = ExtResource("1_l5lfg")
region = Rect2(16, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_vxoib"]
atlas = ExtResource("1_l5lfg")
region = Rect2(0, 0, 16, 16)
[sub_resource type="SpriteFrames" id="SpriteFrames_dvf56"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_1cxu1")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_bi4kn")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_qgntu")
}],
"loop": false,
"name": &"center_to_left",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_0xn7d")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_5xbm6")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_oxghg")
}],
"loop": false,
"name": &"center_to_right",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_6e5gf")
}],
"loop": true,
"name": &"default",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_dxl8p")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_d0i3t")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_oy0eq")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_14w2k")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_m2si1")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_lbhml")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_rw7h1")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_x62ns")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_unrcw")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_y5qth")
}],
"loop": true,
"name": &"full_scan",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_qkmcw")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_myuwn")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_8aa11")
}],
"loop": false,
"name": &"left_to_center",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_u7xyi")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_qrkj0")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_qcqm5")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_34faw")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_j34h0")
}],
"loop": false,
"name": &"left_to_right",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_ojvts")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_kf402")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_aaebm")
}],
"loop": false,
"name": &"right_to_center",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_owve1")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_0eww4")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_0pie4")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_oh7bx")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_vxoib")
}],
"loop": false,
"name": &"right_to_left",
"speed": 5.0
}]
[ext_resource type="SpriteFrames" uid="uid://yfxog8pww6ih" path="res://Resources/Sprites/Camera.tres" id="2_omkb8"]
[ext_resource type="Script" path="res://Scripts/Components/ProximityPlayerDetection.cs" id="3_1qxk5"]
[sub_resource type="CircleShape2D" id="CircleShape2D_nkpag"]
[node name="Camera" type="Area2D"]
[sub_resource type="CircleShape2D" id="CircleShape2D_gs7jc"]
radius = 85.0529
[sub_resource type="RectangleShape2D" id="RectangleShape2D_3bqsq"]
size = Vector2(8, 12)
[node name="Camera" type="CharacterBody2D" node_paths=PackedStringArray("_playerDetection")]
collision_layer = 16
collision_mask = 8
script = ExtResource("1_2qb38")
Health = 1.0
WalkSpeed = 0.0
_playerDetection = NodePath("PlayerDetection")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
sprite_frames = SubResource("SpriteFrames_dvf56")
sprite_frames = ExtResource("2_omkb8")
animation = &"full_scan"
frame_progress = 0.779565
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_nkpag")
[node name="PlayerDetection" type="Area2D" parent="."]
visible = false
collision_layer = 16
collision_mask = 2
script = ExtResource("3_1qxk5")
[node name="PlayerDetectionArea" type="CollisionShape2D" parent="PlayerDetection"]
shape = SubResource("CircleShape2D_gs7jc")
[node name="DamageHitbox" type="Area2D" parent="."]
collision_layer = 16
collision_mask = 9
[node name="CollisionShape2D" type="CollisionShape2D" parent="DamageHitbox"]
shape = SubResource("RectangleShape2D_3bqsq")
[connection signal="area_entered" from="PlayerDetection" to="PlayerDetection" method="_on_area_entered"]
[connection signal="area_exited" from="PlayerDetection" to="PlayerDetection" method="_on_area_exited"]
[connection signal="area_entered" from="DamageHitbox" to="." method="_on_damage_hitbox_area_entered"]

View file

@ -22,12 +22,13 @@ radius = 85.0529
[sub_resource type="RectangleShape2D" id="RectangleShape2D_m1rsg"]
size = Vector2(8, 12)
[node name="Enemy" type="CharacterBody2D" node_paths=PackedStringArray("EquippedWeapon") groups=["Destroyable"]]
[node name="Enemy" type="CharacterBody2D" node_paths=PackedStringArray("EquippedWeapon", "_playerDetection") groups=["Destroyable"]]
collision_layer = 16
collision_mask = 9
script = ExtResource("1_h0ey4")
EquippedWeapon = NodePath("Weapon")
NavigationEnabled = true
_playerDetection = NodePath("PlayerDetection")
_navigationEnabled = true
metadata/_edit_group_ = true
[node name="Sprite2D" type="Sprite2D" parent="."]

View file

@ -28,7 +28,7 @@ collision_mask = 9
script = ExtResource("1_lpwdj")
EquippedWeapon = NodePath("Weapon")
_playerDetection = NodePath("PlayerDetection")
NavigationEnabled = true
_navigationEnabled = true
metadata/_edit_group_ = true
[node name="Sprite2D" type="Sprite2D" parent="."]

View file

@ -0,0 +1,53 @@
[gd_scene load_steps=8 format=3 uid="uid://d1h48wgasakk4"]
[ext_resource type="Script" path="res://Scripts/Interactables/AlarmBox.cs" id="1_usvoy"]
[ext_resource type="Texture2D" uid="uid://bpc66amnvvkrn" path="res://Sprites/AlarmBox.png" id="2_slydm"]
[sub_resource type="CircleShape2D" id="CircleShape2D_vvpve"]
[sub_resource type="AtlasTexture" id="AtlasTexture_uh6p2"]
atlas = ExtResource("2_slydm")
region = Rect2(0, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_wt4ye"]
atlas = ExtResource("2_slydm")
region = Rect2(16, 0, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_ucweu"]
atlas = ExtResource("2_slydm")
region = Rect2(0, 0, 16, 16)
[sub_resource type="SpriteFrames" id="SpriteFrames_kbgi5"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_uh6p2")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_wt4ye")
}],
"loop": true,
"name": &"alarmed",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_ucweu")
}],
"loop": true,
"name": &"default",
"speed": 5.0
}]
[node name="AlarmBox" type="Area2D" groups=["Interactable"]]
collision_layer = 4
collision_mask = 2
script = ExtResource("1_usvoy")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_vvpve")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
sprite_frames = SubResource("SpriteFrames_kbgi5")
animation = &"alarmed"
frame_progress = 0.613245

View file

@ -38,3 +38,7 @@ gravity_scale = 0.0
[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"]
position = Vector2(0, -3)
shape = SubResource("RectangleShape2D_ss2y0")
[node name="NavigationObstacle2D" type="NavigationObstacle2D" parent="."]
radius = 8.36
vertices = PackedVector2Array(-6, -9, 6, -9, 6, 2, -6, 2)

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=25 format=4 uid="uid://bv451a8wgty4u"]
[gd_scene load_steps=27 format=4 uid="uid://bv451a8wgty4u"]
[ext_resource type="Script" path="res://Scripts/GameManager.cs" id="1_8tmoj"]
[ext_resource type="PackedScene" uid="uid://bghghp5ep4w2j" path="res://Scenes/player.tscn" id="2_8mh54"]
@ -17,6 +17,7 @@
[ext_resource type="PackedScene" uid="uid://bc64lr3vlwchq" path="res://Scenes/Door_Vertical.tscn" id="15_mgtvp"]
[ext_resource type="PackedScene" uid="uid://c27co22bjym3c" path="res://Scenes/Actors/Camera.tscn" id="16_clqjt"]
[ext_resource type="PackedScene" uid="uid://cxjumgf8bhr3l" path="res://Scenes/Elevator.tscn" id="16_n40rt"]
[ext_resource type="PackedScene" uid="uid://d1h48wgasakk4" path="res://Scenes/Interactable/alarm_box.tscn" id="17_dppcs"]
[ext_resource type="PackedScene" uid="uid://cdr4m7pydqk6u" path="res://Scenes/Interactable/control_pad_red_keycard.tscn" id="17_e3v0b"]
[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"]
@ -24,6 +25,7 @@
[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"]
[ext_resource type="Script" path="res://Scripts/AlarmManager.cs" id="25_rpwvt"]
[node name="GameScene" type="Node2D" node_paths=PackedStringArray("PlayerSpawnMarker")]
position = Vector2(38, 39)
@ -124,7 +126,16 @@ Target = NodePath("../HorizontalDoor")
position = Vector2(-790, -184)
[node name="Camera" parent="Factory Tilemaps" instance=ExtResource("16_clqjt")]
position = Vector2(-711, -168)
position = Vector2(-649, -168)
[node name="AlarmBox" parent="Factory Tilemaps" instance=ExtResource("17_dppcs")]
position = Vector2(-713, -153)
[node name="AlarmBox2" parent="Factory Tilemaps" instance=ExtResource("17_dppcs")]
position = Vector2(-616, -153)
[node name="AlarmBox3" parent="Factory Tilemaps" instance=ExtResource("17_dppcs")]
position = Vector2(-775, -184)
[node name="CameraController" type="Camera2D" parent="."]
script = ExtResource("6_t8ide")
@ -179,3 +190,6 @@ position = Vector2(-790, -161)
[node name="RedKeyCard2" parent="." instance=ExtResource("19_8fb73")]
position = Vector2(-824, -152)
[node name="AlarmManager" type="Node2D" parent="."]
script = ExtResource("25_rpwvt")