mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:15:45 +00:00
Valves
This commit is contained in:
parent
f9aab9718a
commit
2e8bb70348
13 changed files with 354 additions and 26 deletions
|
|
@ -61,8 +61,6 @@ one_shot = true
|
|||
|
||||
[node name="Weapon" parent="." instance=ExtResource("3_ihce0")]
|
||||
BulletScene = ExtResource("4_iis8b")
|
||||
BulletCapacity = 4
|
||||
BulletSpeed = 50.0
|
||||
|
||||
[node name="NavigationAgent2D" type="NavigationAgent2D" parent="."]
|
||||
target_desired_distance = 64.0
|
||||
|
|
|
|||
106
Scenes/Actors/RoamingSusan.tscn
Normal file
106
Scenes/Actors/RoamingSusan.tscn
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
[gd_scene load_steps=14 format=3 uid="uid://cdti0hnbs3e63"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Enemy.cs" id="1_4rcmp"]
|
||||
[ext_resource type="Texture2D" uid="uid://b7kwstavr73pe" path="res://Sprites/Actors/Robot2.png" id="2_rwx7o"]
|
||||
[ext_resource type="Script" path="res://Scripts/Components/ProximityPlayerDetection.cs" id="3_4nrws"]
|
||||
[ext_resource type="PackedScene" uid="uid://crry0rgk7a8sm" path="res://Scenes/Weapons/BaseWeapon.tscn" id="4_8r0yt"]
|
||||
[ext_resource type="Resource" uid="uid://cdfmedtgp2rcn" path="res://Resources/Weapons/EnemyWeapon.tres" id="5_02uj1"]
|
||||
[ext_resource type="PackedScene" uid="uid://cuixq5ex0j40h" path="res://Scenes/enemyBullet.tscn" id="6_fphoq"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_s1iwv"]
|
||||
atlas = ExtResource("2_rwx7o")
|
||||
region = Rect2(0, 0, 16, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_dan4u"]
|
||||
atlas = ExtResource("2_rwx7o")
|
||||
region = Rect2(16, 0, 16, 32)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_q3w3x"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_s1iwv")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_dan4u")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_8gtts"]
|
||||
radius = 7.0
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_cacb5"]
|
||||
radius = 4.0
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_v711r"]
|
||||
radius = 85.0529
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_m1rsg"]
|
||||
size = Vector2(8, 12)
|
||||
|
||||
[node name="Enemy" type="CharacterBody2D" node_paths=PackedStringArray("EquippedWeapon", "_playerDetection") groups=["Destroyable"]]
|
||||
collision_layer = 16
|
||||
collision_mask = 9
|
||||
script = ExtResource("1_4rcmp")
|
||||
Health = 8.0
|
||||
WalkSpeed = 1000.0
|
||||
AlarmReactRange = 50.0
|
||||
EquippedWeapon = NodePath("Weapon")
|
||||
_playerDetection = NodePath("PlayerDetection")
|
||||
_navigationEnabled = true
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
sprite_frames = SubResource("SpriteFrames_q3w3x")
|
||||
|
||||
[node name="Damage_HitBox" type="CollisionShape2D" parent="."]
|
||||
visible = false
|
||||
shape = SubResource("CircleShape2D_8gtts")
|
||||
|
||||
[node name="RigidBody2D" type="RigidBody2D" parent="."]
|
||||
collision_layer = 16
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"]
|
||||
visible = false
|
||||
position = Vector2(0, 5)
|
||||
shape = SubResource("CircleShape2D_cacb5")
|
||||
|
||||
[node name="PlayerDetection" type="Area2D" parent="."]
|
||||
visible = false
|
||||
collision_layer = 16
|
||||
collision_mask = 2
|
||||
script = ExtResource("3_4nrws")
|
||||
|
||||
[node name="PlayerDetectionArea" type="CollisionShape2D" parent="PlayerDetection"]
|
||||
shape = SubResource("CircleShape2D_v711r")
|
||||
|
||||
[node name="ShootTimer" type="Timer" parent="."]
|
||||
wait_time = 0.4
|
||||
one_shot = true
|
||||
|
||||
[node name="Weapon" parent="." instance=ExtResource("4_8r0yt")]
|
||||
WeaponData = ExtResource("5_02uj1")
|
||||
BulletScene = ExtResource("6_fphoq")
|
||||
|
||||
[node name="NavigationAgent2D" type="NavigationAgent2D" parent="."]
|
||||
target_desired_distance = 64.0
|
||||
path_max_distance = 800.0
|
||||
path_postprocessing = 1
|
||||
avoidance_enabled = true
|
||||
debug_enabled = true
|
||||
debug_path_custom_color = Color(1, 0, 0, 1)
|
||||
|
||||
[node name="DamageHitbox" type="Area2D" parent="."]
|
||||
collision_layer = 16
|
||||
collision_mask = 9
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="DamageHitbox"]
|
||||
shape = SubResource("RectangleShape2D_m1rsg")
|
||||
|
||||
[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="velocity_computed" from="NavigationAgent2D" to="." method="_on_navigation_agent_2d_velocity_computed"]
|
||||
[connection signal="area_entered" from="DamageHitbox" to="." method="_on_damage_hitbox_area_entered"]
|
||||
|
|
@ -30,7 +30,7 @@ collision_layer = 16
|
|||
collision_mask = 9
|
||||
script = ExtResource("1_na4uq")
|
||||
BossName = "Rumia"
|
||||
Phases = Array[Resource]([ExtResource("2_eyxw4"), ExtResource("2_1rhf6"), ExtResource("3_j7lbl"), ExtResource("2_p8j4e")])
|
||||
Phases = Array[Resource]([ExtResource("2_1rhf6"), ExtResource("3_j7lbl"), ExtResource("2_eyxw4"), ExtResource("2_p8j4e")])
|
||||
BossHudPrefab = ExtResource("4_ehp8q")
|
||||
_bossPortraitTexture = ExtResource("4_at5iq")
|
||||
Health = 200.0
|
||||
|
|
|
|||
45
Scenes/Interactable/Valve.tscn
Normal file
45
Scenes/Interactable/Valve.tscn
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://b0pb078xylxy"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Interactables/Valve.cs" id="1_d6av1"]
|
||||
[ext_resource type="Texture2D" uid="uid://dgorww4m2rfqf" path="res://Sprites/Actors/Valve.png" id="2_bapfy"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_vvpve"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_oj5hl"]
|
||||
atlas = ExtResource("2_bapfy")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_q1xli"]
|
||||
atlas = ExtResource("2_bapfy")
|
||||
region = Rect2(16, 0, 16, 16)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_n48sd"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_oj5hl")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"Closed",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_q1xli")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"Open",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[node name="Valve" type="Area2D" groups=["Interactable"]]
|
||||
collision_layer = 4
|
||||
collision_mask = 2
|
||||
script = ExtResource("1_d6av1")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_vvpve")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
sprite_frames = SubResource("SpriteFrames_n48sd")
|
||||
animation = &"Open"
|
||||
File diff suppressed because one or more lines are too long
74
Scripts/Interactables/Valve.cs
Normal file
74
Scripts/Interactables/Valve.cs
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
using System;
|
||||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Interactables;
|
||||
|
||||
public partial class Valve : Interactable
|
||||
{
|
||||
[Export] public Node2D Target { get; set; }
|
||||
|
||||
[Export]
|
||||
private DoorState _activationState = DoorState.Closed;
|
||||
|
||||
private AnimatedSprite2D _animatedSprite;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_animatedSprite = GetNode<AnimatedSprite2D>("AnimatedSprite2D");
|
||||
|
||||
SetState(_activationState);
|
||||
}
|
||||
|
||||
public override bool Activate()
|
||||
{
|
||||
if (MeetsRequirements() && Target is IActivable activatable)
|
||||
{
|
||||
switch (_activationState)
|
||||
{
|
||||
case DoorState.Closed:
|
||||
activatable.Activate(ActivationType.Enable);
|
||||
Open();
|
||||
break;
|
||||
case DoorState.Open:
|
||||
activatable.Activate(ActivationType.Disable);
|
||||
Close();
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Open()
|
||||
{
|
||||
_animatedSprite.Play("Open");
|
||||
_activationState = DoorState.Open;
|
||||
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
_animatedSprite.Play("Closed");
|
||||
_activationState = DoorState.Closed;
|
||||
|
||||
}
|
||||
|
||||
private void SetState(DoorState state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case DoorState.Closed:
|
||||
Close();
|
||||
break;
|
||||
case DoorState.Open:
|
||||
Open();
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,9 +4,5 @@ namespace Cirno.Scripts.Resources.TestGeneric;
|
|||
|
||||
public partial class GenericTestNode : Node2D
|
||||
{
|
||||
|
||||
[Export] public GenericTestResourceBase TestResource { get; set; } = null!;
|
||||
|
||||
|
||||
|
||||
}
|
||||
BIN
Sprites/Actors/Valve.aseprite
(Stored with Git LFS)
Normal file
BIN
Sprites/Actors/Valve.aseprite
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Sprites/Actors/Valve.png
(Stored with Git LFS)
Normal file
BIN
Sprites/Actors/Valve.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
Sprites/Actors/Valve.png.import
Normal file
34
Sprites/Actors/Valve.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dgorww4m2rfqf"
|
||||
path="res://.godot/imported/Valve.png-6de6829a45692a23494108e8fccaa1b3.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/Actors/Valve.png"
|
||||
dest_files=["res://.godot/imported/Valve.png-6de6829a45692a23494108e8fccaa1b3.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
Tilesets/factory.aseprite
(Stored with Git LFS)
BIN
Tilesets/factory.aseprite
(Stored with Git LFS)
Binary file not shown.
BIN
Tilesets/factory.png
(Stored with Git LFS)
BIN
Tilesets/factory.png
(Stored with Git LFS)
Binary file not shown.
|
|
@ -221,6 +221,11 @@ texture = ExtResource("1_70kxh")
|
|||
8:5/0 = 0
|
||||
8:5/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_ajuv4")
|
||||
9:5/0 = 0
|
||||
9:5/0/terrain_set = 0
|
||||
9:5/0/terrain = 1
|
||||
9:5/0/terrains_peering_bit/right_side = 1
|
||||
9:5/0/terrains_peering_bit/bottom_side = 1
|
||||
9:5/0/terrains_peering_bit/left_side = 1
|
||||
0:6/0 = 0
|
||||
0:6/0/terrain_set = 0
|
||||
0:6/0/terrain = 2
|
||||
|
|
@ -261,6 +266,11 @@ texture = ExtResource("1_70kxh")
|
|||
8:6/0 = 0
|
||||
8:6/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_63d1d")
|
||||
9:6/0 = 0
|
||||
9:6/0/terrain_set = 0
|
||||
9:6/0/terrain = 1
|
||||
9:6/0/terrains_peering_bit/right_side = 1
|
||||
9:6/0/terrains_peering_bit/bottom_side = 1
|
||||
9:6/0/terrains_peering_bit/top_side = 1
|
||||
0:7/0 = 0
|
||||
0:7/0/terrain_set = 0
|
||||
0:7/0/terrain = 2
|
||||
|
|
@ -608,6 +618,27 @@ texture = ExtResource("1_70kxh")
|
|||
5:14/0 = 0
|
||||
6:3/0 = 0
|
||||
6:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-4, -6, -4, 0, 4, 0, 4, -6)
|
||||
10:5/0 = 0
|
||||
10:5/0/terrain_set = 0
|
||||
10:5/0/terrain = 1
|
||||
10:5/0/terrains_peering_bit/right_side = 1
|
||||
10:5/0/terrains_peering_bit/left_side = 1
|
||||
10:5/0/terrains_peering_bit/top_side = 1
|
||||
10:6/0 = 0
|
||||
10:6/0/terrain_set = 0
|
||||
10:6/0/terrain = 1
|
||||
10:6/0/terrains_peering_bit/bottom_side = 1
|
||||
10:6/0/terrains_peering_bit/left_side = 1
|
||||
10:6/0/terrains_peering_bit/top_side = 1
|
||||
10:7/0 = 0
|
||||
4:6/0 = 0
|
||||
4:6/0/terrain_set = 0
|
||||
4:6/0/terrain = 1
|
||||
4:6/0/terrains_peering_bit/right_side = 1
|
||||
4:6/0/terrains_peering_bit/bottom_side = 1
|
||||
4:6/0/terrains_peering_bit/left_side = 1
|
||||
4:6/0/terrains_peering_bit/top_side = 1
|
||||
4:7/0 = 0
|
||||
|
||||
[sub_resource type="TileSetScenesCollectionSource" id="TileSetScenesCollectionSource_qg3vu"]
|
||||
resource_name = "Props"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue