diff --git a/Resources/Bullets/Boss/Rumia/LaserBulletTest.tres b/Resources/Bullets/Boss/Rumia/LaserBulletTest.tres index 17617033..fc6a5c78 100644 --- a/Resources/Bullets/Boss/Rumia/LaserBulletTest.tres +++ b/Resources/Bullets/Boss/Rumia/LaserBulletTest.tres @@ -30,4 +30,6 @@ DestroyOnCollision = false Owner = 2 DamageType = 0 Controllable = false +Grazeable = false +GrazeValue = 1.0 TimeModifiers = Array[Object]([SubResource("Resource_3a5dw"), SubResource("Resource_rtncg")]) diff --git a/Resources/Bullets/Explosion_Harmless.tres b/Resources/Bullets/Explosion_Harmless.tres index fe35ecea..21b79a59 100644 --- a/Resources/Bullets/Explosion_Harmless.tres +++ b/Resources/Bullets/Explosion_Harmless.tres @@ -13,4 +13,7 @@ LifeTime = 1.0 DestroyOnCollision = false Owner = 0 DamageType = 4 +Controllable = false +Grazeable = false +GrazeValue = 1.0 TimeModifiers = null diff --git a/Resources/Bullets/Fire_Emitter_Bullet.tres b/Resources/Bullets/Fire_Emitter_Bullet.tres index 5d564b73..5ce7ca58 100644 --- a/Resources/Bullets/Fire_Emitter_Bullet.tres +++ b/Resources/Bullets/Fire_Emitter_Bullet.tres @@ -14,5 +14,7 @@ DestroyOnCollision = false Owner = 0 DamageType = 2 Controllable = false +Grazeable = false +GrazeValue = 1.0 TimeModifiers = null metadata/_custom_type_script = "uid://dslyrfcej3g2n" diff --git a/Resources/Bullets/Spider_Bomb_Bullet.tres b/Resources/Bullets/Spider_Bomb_Bullet.tres index 6a4882df..a9c69eb7 100644 --- a/Resources/Bullets/Spider_Bomb_Bullet.tres +++ b/Resources/Bullets/Spider_Bomb_Bullet.tres @@ -16,5 +16,7 @@ DestroyOnCollision = true Owner = 1 DamageType = 0 Controllable = true +Grazeable = false +GrazeValue = 1.0 TimeModifiers = null metadata/_custom_type_script = "uid://dslyrfcej3g2n" diff --git a/Resources/Bullets/cheat_bullet.tres b/Resources/Bullets/cheat_bullet.tres index d322e55c..a049581e 100644 --- a/Resources/Bullets/cheat_bullet.tres +++ b/Resources/Bullets/cheat_bullet.tres @@ -28,4 +28,6 @@ DestroyOnCollision = true Owner = 1 DamageType = 0 Controllable = false +Grazeable = false +GrazeValue = 1.0 TimeModifiers = Array[Object]([SubResource("Resource_26vvh")]) diff --git a/Resources/Bullets/nuclear_bullets.tres b/Resources/Bullets/nuclear_bullets.tres index 146ff9e7..c34db4b8 100644 --- a/Resources/Bullets/nuclear_bullets.tres +++ b/Resources/Bullets/nuclear_bullets.tres @@ -16,4 +16,6 @@ DestroyOnCollision = true Owner = 1 DamageType = 2 Controllable = false +Grazeable = false +GrazeValue = -1.0 TimeModifiers = null diff --git a/Resources/Bullets/simple_ice_bullet.tres b/Resources/Bullets/simple_ice_bullet.tres index 96cec3ca..8ee24140 100644 --- a/Resources/Bullets/simple_ice_bullet.tres +++ b/Resources/Bullets/simple_ice_bullet.tres @@ -15,4 +15,7 @@ LifeTime = 10.0 DestroyOnCollision = true Owner = 1 DamageType = 3 +Controllable = false +Grazeable = false +GrazeValue = 1.0 TimeModifiers = null diff --git a/Resources/Bullets/yin_yang_bullet.tres b/Resources/Bullets/yin_yang_bullet.tres index 79a3e79b..b9f5f268 100644 --- a/Resources/Bullets/yin_yang_bullet.tres +++ b/Resources/Bullets/yin_yang_bullet.tres @@ -28,4 +28,6 @@ DestroyOnCollision = true Owner = 1 DamageType = 1 Controllable = false +Grazeable = false +GrazeValue = 1.0 TimeModifiers = Array[Object]([SubResource("Resource_lcgqc")]) diff --git a/Resources/Enemies/Base_Fairy_Special.tres b/Resources/Enemies/Base_Fairy_Special.tres new file mode 100644 index 00000000..be033fe0 --- /dev/null +++ b/Resources/Enemies/Base_Fairy_Special.tres @@ -0,0 +1,60 @@ +[gd_resource type="Resource" script_class="EnemyResource" load_steps=14 format=3 uid="uid://cqfyuurvqb8m6"] + +[ext_resource type="Script" uid="uid://cq65aed620ijo" path="res://Scripts/Resources/Loot/LootDrop.cs" id="1_tf7s2"] +[ext_resource type="Resource" uid="uid://ct1fa2huvy34n" path="res://Resources/Items/Ammo1.tres" id="2_kekqr"] +[ext_resource type="Resource" uid="uid://dy53gia1tmkah" path="res://Resources/Items/Points_Pickup.tres" id="3_c0hok"] +[ext_resource type="Resource" uid="uid://bhbufxodybsw4" path="res://Resources/Items/Shield_Pickup.tres" id="4_o6iyn"] +[ext_resource type="Resource" uid="uid://dodwpect0ldjf" path="res://Resources/Items/Heart_Pickup.tres" id="5_onxa8"] +[ext_resource type="Resource" uid="uid://clr1gln7nxa1o" path="res://Resources/Items/Power_Pickup.tres" id="6_1cdvd"] +[ext_resource type="Resource" uid="uid://d27t8ruig8lie" path="res://Resources/Weapons/EnemyShotgun.tres" id="7_tf7s2"] +[ext_resource type="Script" uid="uid://cd5o0ceb50jki" path="res://Scripts/Resources/EnemyResource.cs" id="8_8fxhl"] + +[sub_resource type="Resource" id="Resource_c8nix"] +script = ExtResource("1_tf7s2") +Item = ExtResource("2_kekqr") +Chance = 40.0 +metadata/_custom_type_script = "uid://cq65aed620ijo" + +[sub_resource type="Resource" id="Resource_gs2l3"] +script = ExtResource("1_tf7s2") +Item = ExtResource("3_c0hok") +Chance = 10.0 +metadata/_custom_type_script = "uid://cq65aed620ijo" + +[sub_resource type="Resource" id="Resource_sqnvg"] +script = ExtResource("1_tf7s2") +Item = ExtResource("4_o6iyn") +Chance = 5.0 +metadata/_custom_type_script = "uid://cq65aed620ijo" + +[sub_resource type="Resource" id="Resource_5tyar"] +script = ExtResource("1_tf7s2") +Item = ExtResource("5_onxa8") +Chance = 5.0 +metadata/_custom_type_script = "uid://cq65aed620ijo" + +[sub_resource type="Resource" id="Resource_48xq6"] +script = ExtResource("1_tf7s2") +Item = ExtResource("6_1cdvd") +Chance = 6.0 +metadata/_custom_type_script = "uid://cq65aed620ijo" + +[resource] +script = ExtResource("8_8fxhl") +EnemyName = &"Special Fairy" +EnemyKey = &"FAIRY_BASE_SPECIAL" +PrefabPath = &"res://Scenes/Actors/Fairy_Special_FSM.tscn" +MaxHealth = 4.0 +MovementSpeed = 30.0 +Weapon = ExtResource("7_tf7s2") +LootDrops = Array[ExtResource("1_tf7s2")]([SubResource("Resource_c8nix"), SubResource("Resource_gs2l3"), SubResource("Resource_sqnvg"), SubResource("Resource_5tyar"), SubResource("Resource_48xq6")]) +MotivationReward = 4.0 +PlayerDetectionRange = 90.0 +ViewRange = 120.0 +AlarmReactRange = 150.0 +PlayerDisengageRange = 200.0 +StrafeSpeed = 25.0 +MaxStrafeDistance = 16.0 +MinStrafeDistance = 8.0 +ResponseTime = 0.5 +metadata/_custom_type_script = "uid://cd5o0ceb50jki" diff --git a/Resources/Sprites/base_fairy_special.tres b/Resources/Sprites/base_fairy_special.tres new file mode 100644 index 00000000..765904a2 --- /dev/null +++ b/Resources/Sprites/base_fairy_special.tres @@ -0,0 +1,86 @@ +[gd_resource type="SpriteFrames" load_steps=11 format=3 uid="uid://cnl6ju3qlr2bj"] + +[ext_resource type="Texture2D" uid="uid://xgxxdq37pykh" path="res://Sprites/Actors/Fairy.png" id="1_jhe43"] +[ext_resource type="Texture2D" uid="uid://callpd48wwnlw" path="res://Sprites/Actors/Fairy_Special.png" id="2_ucisl"] + +[sub_resource type="AtlasTexture" id="AtlasTexture_13sn2"] +atlas = ExtResource("1_jhe43") +region = Rect2(0, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_qs3gm"] +atlas = ExtResource("1_jhe43") +region = Rect2(16, 0, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_fppxn"] +atlas = ExtResource("1_jhe43") +region = Rect2(0, 32, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_b01sl"] +atlas = ExtResource("1_jhe43") +region = Rect2(16, 32, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_jgccb"] +atlas = ExtResource("1_jhe43") +region = Rect2(0, 16, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_v7nm4"] +atlas = ExtResource("1_jhe43") +region = Rect2(16, 16, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_pt5ys"] +atlas = ExtResource("2_ucisl") +region = Rect2(0, 48, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_cplfv"] +atlas = ExtResource("2_ucisl") +region = Rect2(16, 48, 16, 16) + +[resource] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_13sn2") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_qs3gm") +}], +"loop": true, +"name": &"down", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_fppxn") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_b01sl") +}], +"loop": true, +"name": &"left", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_jgccb") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_v7nm4") +}], +"loop": true, +"name": &"right", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_pt5ys") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_pt5ys") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_cplfv") +}], +"loop": true, +"name": &"up", +"speed": 5.0 +}] diff --git a/Resources/Weapons/EnemyShotgun.tres b/Resources/Weapons/EnemyShotgun.tres new file mode 100644 index 00000000..844f9b5f --- /dev/null +++ b/Resources/Weapons/EnemyShotgun.tres @@ -0,0 +1,20 @@ +[gd_resource type="Resource" script_class="WeaponResource" load_steps=3 format=3 uid="uid://d27t8ruig8lie"] + +[ext_resource type="Resource" uid="uid://dqnvesdj0dk3v" path="res://Resources/Bullets/simple_enemy_bullet.tres" id="1_gd1fn"] +[ext_resource type="Script" uid="uid://b6fmrnipv88bk" path="res://Scripts/Resources/WeaponResource.cs" id="2_gblpw"] + +[resource] +script = ExtResource("2_gblpw") +Name = &"Enemy Shotgun" +BulletData = ExtResource("1_gd1fn") +RateOfFire = 0.3 +BulletCapacity = 4 +ReloadTime = 1.0 +AutoReload = true +InfiniteAmmo = true +BulletsPerShot = 2 +SpreadAngle = 20.0 +RandomSpread = 0.0 +ItemKey = null +AmmoKey = null +_rotationOffset = 0.0 diff --git a/Scenes/Actors/Fairy_Special_FSM.tscn b/Scenes/Actors/Fairy_Special_FSM.tscn new file mode 100644 index 00000000..daae69d0 --- /dev/null +++ b/Scenes/Actors/Fairy_Special_FSM.tscn @@ -0,0 +1,230 @@ +[gd_scene load_steps=36 format=3 uid="uid://bq4r28ikbmn0r"] + +[ext_resource type="Script" uid="uid://bi2edpdosngll" path="res://Scripts/Components/FSM/Enemy/EnemyFSMProxy.cs" id="1_8jo7b"] +[ext_resource type="Resource" uid="uid://cqfyuurvqb8m6" path="res://Resources/Enemies/Base_Fairy_Special.tres" id="2_8jo7b"] +[ext_resource type="Script" uid="uid://dn6dbog1s2818" path="res://Scripts/Components/FSM/Enemy/EnemyStateMachine.cs" id="3_mximv"] +[ext_resource type="Script" uid="uid://rrelumir3g6n" path="res://Scripts/Components/FSM/Enemy/Init.cs" id="4_t1tlp"] +[ext_resource type="Script" uid="uid://bjrh5q24nuoec" path="res://Scripts/Components/FSM/Enemy/Idle.cs" id="5_n8ko4"] +[ext_resource type="Script" uid="uid://dbmc3klko5x18" path="res://Scripts/Components/FSM/Enemy/Alert.cs" id="6_ydeam"] +[ext_resource type="Script" uid="uid://7mig30eneu8x" path="res://Scripts/Components/FSM/Enemy/Shooting.cs" id="7_i8tpe"] +[ext_resource type="Script" uid="uid://4hwtlc1ftjsc" path="res://Scripts/Components/FSM/Enemy/Dead.cs" id="8_le3c7"] +[ext_resource type="Script" uid="uid://dj37rup1ibnn6" path="res://Scripts/Components/FSM/Enemy/Controlled.cs" id="9_aujmv"] +[ext_resource type="SpriteFrames" uid="uid://cnl6ju3qlr2bj" path="res://Resources/Sprites/base_fairy_special.tres" id="10_8jo7b"] +[ext_resource type="Script" uid="uid://mb4ugq74a17c" path="res://Scripts/Components/FSM/Enemy/PlayerDetectionModule.cs" id="11_3kqmr"] +[ext_resource type="Script" uid="uid://bflvr26h52c55" path="res://Scripts/Components/FSM/Enemy/EnemyStorageModule.cs" id="12_e1t8h"] +[ext_resource type="Script" uid="uid://cq3hkweplldbr" path="res://Scripts/Components/Actors/GenericDamageReceiver.cs" id="13_mm4bn"] +[ext_resource type="PackedScene" uid="uid://dmumxecckh42r" path="res://Scenes/Activable/BrokenFloorEmitter.tscn" id="14_be3bw"] +[ext_resource type="Script" uid="uid://cqwvssstkrdmw" path="res://Scripts/Components/Actors/ActorResourceProvider.cs" id="15_lb7n2"] +[ext_resource type="Script" uid="uid://ik7s65de723k" path="res://Scripts/Components/FSM/Enemy/NavigationMovementModule.cs" id="16_0kid0"] +[ext_resource type="PackedScene" uid="uid://cj63k0dmk7tl1" path="res://Scenes/Weapons/enemy_weapon_base.tscn" id="17_37fbm"] +[ext_resource type="Resource" uid="uid://csdlihliv4cr8" path="res://Resources/Weapons/EnemyWeapon_simple.tres" id="18_eqabw"] +[ext_resource type="Script" uid="uid://dhsqsajq537qn" path="res://Scripts/Components/FSM/Enemy/EnemyAlarmModule.cs" id="19_cqdny"] +[ext_resource type="Script" uid="uid://bo5sgbv1t8ril" path="res://Scripts/Components/Actors/PlayerAnimationProvider.cs" id="20_bi6th"] +[ext_resource type="Material" uid="uid://dnvwgyt2tbqmr" path="res://Resources/Materials/Player_Blink_Teleport_Material.tres" id="21_7je66"] +[ext_resource type="Script" uid="uid://dncdgq843sj2f" path="res://Scripts/Components/FSM/Enemy/AnimationModule.cs" id="22_23wbc"] +[ext_resource type="Script" uid="uid://bw4t2clyr6lib" path="res://Scripts/Components/FSM/Enemy/EnemyDropsProvider.cs" id="23_5aqmo"] +[ext_resource type="Texture2D" uid="uid://b2v6j7lsyltrc" path="res://Sprites/Actors/CirnoWings.png" id="24_vyr38"] +[ext_resource type="Script" uid="uid://dq338w2lw5phl" path="res://Scripts/Components/Actors/KeyboardInputProvider.cs" id="25_e32jm"] +[ext_resource type="Script" uid="uid://d208gvthkstvc" path="res://Scripts/Components/Actors/PlayerCrosshairProvider.cs" id="26_1qijx"] +[ext_resource type="Texture2D" uid="uid://cf2855sd3hqty" path="res://Sprites/Actors/Aiming_Reticule_Small.png" id="27_j5is2"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_pnkma"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_5wstg"] +radius = 29.0 + +[sub_resource type="CircleShape2D" id="CircleShape2D_6x22m"] +radius = 5.0 + +[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_poxpj"] +particle_flag_disable_z = true +emission_shape = 2 +emission_sphere_radius = 16.0 +orbit_velocity_min = -1.0 +orbit_velocity_max = 1.098 +gravity = Vector3(0, 0, 0) +color = Color(0.0392157, 0.380392, 1, 1) + +[sub_resource type="AtlasTexture" id="AtlasTexture_urwql"] +atlas = ExtResource("24_vyr38") +region = Rect2(0, 0, 16, 16) + +[sub_resource type="SpriteFrames" id="SpriteFrames_wafqr"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_urwql") +}], +"loop": true, +"name": &"default", +"speed": 5.0 +}] + +[sub_resource type="AtlasTexture" id="AtlasTexture_12erk"] +atlas = ExtResource("27_j5is2") +region = Rect2(0, 0, 16, 16) + +[sub_resource type="SpriteFrames" id="SpriteFrames_biwfl"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_12erk") +}], +"loop": true, +"name": &"default", +"speed": 5.0 +}] + +[node name="FairyFsm" type="CharacterBody2D" node_paths=PackedStringArray("EnemyFSM")] +collision_layer = 16 +collision_mask = 33 +script = ExtResource("1_8jo7b") +EnemyFSM = NodePath("StateMachine") +EnemyResource = ExtResource("2_8jo7b") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource("CircleShape2D_pnkma") + +[node name="StateMachine" type="Node2D" parent="."] +script = ExtResource("3_mximv") + +[node name="Init" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("DamageReceiver", "StorageModule")] +script = ExtResource("4_t1tlp") +DamageReceiver = NodePath("../../DamageReceiver") +StorageModule = NodePath("../../Storage") + +[node name="Idle" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("StorageModule", "PlayerDetection", "DamageReceiver", "_moduleNodes")] +script = ExtResource("5_n8ko4") +StorageModule = NodePath("../../Storage") +PlayerDetection = NodePath("../../PlayerDetection") +DamageReceiver = NodePath("../../DamageReceiver") +_moduleNodes = [NodePath("../../AlarmModule"), NodePath("../../AnimationModule")] + +[node name="Alert" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("StorageModule", "PlayerDetection", "DamageReceiver", "NavigationModule", "_moduleNodes")] +script = ExtResource("6_ydeam") +StorageModule = NodePath("../../Storage") +PlayerDetection = NodePath("../../PlayerDetection") +DamageReceiver = NodePath("../../DamageReceiver") +NavigationModule = NodePath("../../NavigationModule") +_moduleNodes = [NodePath("../../AnimationModule")] + +[node name="Shooting" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("StorageModule", "PlayerDetection", "DamageReceiver", "NavigationModule", "EquippedWeapon", "_moduleNodes")] +script = ExtResource("7_i8tpe") +StorageModule = NodePath("../../Storage") +PlayerDetection = NodePath("../../PlayerDetection") +DamageReceiver = NodePath("../../DamageReceiver") +NavigationModule = NodePath("../../NavigationModule") +EquippedWeapon = NodePath("../../EnemyWeapon") +_moduleNodes = [NodePath("../../AnimationModule")] + +[node name="Dead" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("StorageModule", "DropsProvider")] +script = ExtResource("8_le3c7") +StorageModule = NodePath("../../Storage") +DropsProvider = NodePath("../../DropsProvider") + +[node name="Controlled" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("StorageModule", "DamageReceiver", "_inputProvider", "CrosshairProvider", "EquippedWeapon", "_moduleNodes")] +script = ExtResource("9_aujmv") +StorageModule = NodePath("../../Storage") +DamageReceiver = NodePath("../../DamageReceiver") +_inputProvider = NodePath("../../InputProvider") +CrosshairProvider = NodePath("../../CrosshairProvider") +EquippedWeapon = NodePath("../../EnemyWeapon") +_moduleNodes = [NodePath("../../AnimationModule")] + +[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] +sprite_frames = ExtResource("10_8jo7b") +animation = &"up" + +[node name="PlayerDetection" type="Area2D" parent="."] +collision_layer = 0 +collision_mask = 2 +script = ExtResource("11_3kqmr") +ObstaclesCollisionMask = 81 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="PlayerDetection"] +shape = SubResource("CircleShape2D_5wstg") + +[node name="Storage" type="Node2D" parent="." node_paths=PackedStringArray("Root")] +script = ExtResource("12_e1t8h") +Root = NodePath("..") + +[node name="DamageReceiver" type="Area2D" parent="." node_paths=PackedStringArray("HealthProvider")] +collision_layer = 0 +collision_mask = 136 +script = ExtResource("13_mm4bn") +HealthProvider = NodePath("Health") +BulletGroup = 2 +Debris = ExtResource("14_be3bw") +DeleteParentOnDeath = false + +[node name="CollisionShape2D" type="CollisionShape2D" parent="DamageReceiver"] +position = Vector2(0, 3.865) +shape = SubResource("CircleShape2D_6x22m") + +[node name="Health" type="Node2D" parent="DamageReceiver"] +script = ExtResource("15_lb7n2") +ResourceName = "Health" + +[node name="NavigationModule" type="Node2D" parent="." node_paths=PackedStringArray("StorageModule")] +script = ExtResource("16_0kid0") +StorageModule = NodePath("../Storage") + +[node name="NavigationAgent2D" type="NavigationAgent2D" parent="NavigationModule"] +target_desired_distance = 8.0 +path_max_distance = 800.0 +path_postprocessing = 1 +avoidance_enabled = true +debug_path_custom_color = Color(1, 0, 0, 1) + +[node name="EnemyWeapon" parent="." instance=ExtResource("17_37fbm")] +WeaponData = ExtResource("18_eqabw") + +[node name="AlarmModule" type="Node2D" parent="." node_paths=PackedStringArray("PlayerDetection")] +script = ExtResource("19_cqdny") +PlayerDetection = NodePath("../PlayerDetection") + +[node name="AnimationProvider" type="Node2D" parent="." node_paths=PackedStringArray("_animatedSprite", "_shieldParticles")] +script = ExtResource("20_bi6th") +_animatedSprite = NodePath("../AnimatedSprite2D") +_shieldParticles = NodePath("ShieldParticles") +WalkRightAnimationName = &"right" +WalkLeftAnimationName = &"left" +WalkDownAnimationName = &"down" +WalkUpAnimationName = &"up" +BlinkMaterial = ExtResource("21_7je66") + +[node name="ShieldParticles" type="GPUParticles2D" parent="AnimationProvider"] +emitting = false +amount = 32 +lifetime = 0.4 +one_shot = true +process_material = SubResource("ParticleProcessMaterial_poxpj") + +[node name="AnimationModule" type="Node2D" parent="." node_paths=PackedStringArray("AnimationProvider", "StorageModule")] +script = ExtResource("22_23wbc") +AnimationProvider = NodePath("../AnimationProvider") +StorageModule = NodePath("../Storage") + +[node name="DropsProvider" type="Node2D" parent="." node_paths=PackedStringArray("StorageModule")] +script = ExtResource("23_5aqmo") +StorageModule = NodePath("../Storage") + +[node name="PossessionWings" type="AnimatedSprite2D" parent="."] +visible = false +sprite_frames = SubResource("SpriteFrames_wafqr") + +[node name="InputProvider" type="Node2D" parent="."] +script = ExtResource("25_e32jm") + +[node name="CrosshairProvider" type="Node2D" parent="." node_paths=PackedStringArray("AnimatedSprite")] +script = ExtResource("26_1qijx") +AnimatedSprite = NodePath("Crosshair") +CrosshairDistance = 35.0 + +[node name="Crosshair" type="AnimatedSprite2D" parent="CrosshairProvider"] +sprite_frames = SubResource("SpriteFrames_biwfl") + +[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="DamageReceiver" to="DamageReceiver" method="_on_damage_hitbox_area_entered"] +[connection signal="velocity_computed" from="NavigationModule/NavigationAgent2D" to="NavigationModule" method="_on_navigation_agent_2d_velocity_computed"] diff --git a/Scenes/Actors/fsm_player.tscn b/Scenes/Actors/fsm_player.tscn index d6552b54..53dd73d2 100644 --- a/Scenes/Actors/fsm_player.tscn +++ b/Scenes/Actors/fsm_player.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=83 format=3 uid="uid://c4pr2707hbeph"] +[gd_scene load_steps=85 format=3 uid="uid://c4pr2707hbeph"] [ext_resource type="Script" uid="uid://d2ubk5gucny6s" path="res://Scripts/Components/FSM/PlayerFSMProxy.cs" id="1_g3wua"] [ext_resource type="Script" uid="uid://bw2hakslndaxm" path="res://Scripts/Components/FSM/PlayerStateMachine.cs" id="1_mpmil"] @@ -41,6 +41,7 @@ [ext_resource type="Resource" uid="uid://dy53gia1tmkah" path="res://Resources/Items/Points_Pickup.tres" id="39_nfq4p"] [ext_resource type="Resource" uid="uid://clr1gln7nxa1o" path="res://Resources/Items/Power_Pickup.tres" id="40_m1iep"] [ext_resource type="Script" uid="uid://c8f4tbcjcfsu1" path="res://Scripts/Components/FSM/Player/AutoPickupModule.cs" id="41_v2m0j"] +[ext_resource type="Script" uid="uid://d2r5eh3wn16bg" path="res://Scripts/Components/FSM/Player/PlayerGrazingModule.cs" id="42_awrib"] [sub_resource type="CircleShape2D" id="CircleShape2D_b3hxm"] radius = 5.0 @@ -318,6 +319,8 @@ radius = 2.05679 [sub_resource type="CircleShape2D" id="CircleShape2D_qlmfy"] radius = 3.16228 +[sub_resource type="CircleShape2D" id="CircleShape2D_awrib"] + [node name="FSMPlayer" type="CharacterBody2D" node_paths=PackedStringArray("PlayerFSM", "InteractionController")] process_mode = 1 collision_layer = 2 @@ -350,7 +353,7 @@ _damageReceiver = NodePath("../../DamageReceiver") _activationProvider = NodePath("../../InteractionProvider") _interactionController = NodePath("../../InteractionController") _storageModule = NodePath("../../Storage") -_moduleNodes = [NodePath("../../InteractionController"), NodePath("../../ItemUser"), NodePath("../../ConveyorBeltMover"), NodePath("../../AutoPickupModule")] +_moduleNodes = [NodePath("../../InteractionController"), NodePath("../../ItemUser"), NodePath("../../ConveyorBeltMover"), NodePath("../../AutoPickupModule"), NodePath("../../GrazingModule")] [node name="Cutscene" type="Node2D" parent="StateMachine" node_paths=PackedStringArray("_animationProvider")] script = ExtResource("4_22ff8") @@ -549,6 +552,15 @@ script = ExtResource("41_v2m0j") visible = false shape = SubResource("CircleShape2D_qlmfy") +[node name="GrazingModule" type="Area2D" parent="." node_paths=PackedStringArray("Shield")] +collision_layer = 0 +collision_mask = 136 +script = ExtResource("42_awrib") +Shield = NodePath("../DamageReceiver/ShieldProvider") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="GrazingModule"] +shape = SubResource("CircleShape2D_awrib") + [connection signal="area_entered" from="DamageReceiver" to="DamageReceiver" method="_on_damage_hitbox_area_entered"] [connection signal="area_entered" from="InteractionProvider" to="InteractionProvider" method="_on_interaction_controller_area_entered"] [connection signal="area_exited" from="InteractionProvider" to="InteractionProvider" method="_on_interaction_controller_area_exited"] diff --git a/Scenes/test.tscn b/Scenes/test.tscn index 473cc519..511a9535 100644 --- a/Scenes/test.tscn +++ b/Scenes/test.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=145 format=4 uid="uid://bv451a8wgty4u"] +[gd_scene load_steps=146 format=4 uid="uid://bv451a8wgty4u"] [ext_resource type="Script" uid="uid://doxmbokehw8ci" path="res://Scripts/GameManager.cs" id="1_8tmoj"] [ext_resource type="PackedScene" uid="uid://c4pr2707hbeph" path="res://Scenes/Actors/fsm_player.tscn" id="2_ksslq"] @@ -114,6 +114,7 @@ [ext_resource type="PackedScene" uid="uid://ey71mxa5ocpn" path="res://Scenes/Items/Shield_Extend_Pickup.tscn" id="103_0bqta"] [ext_resource type="PackedScene" uid="uid://bb32f4p5e671j" path="res://Scenes/Actors/Fairy_Guard_FSM.tscn" id="103_f37sa"] [ext_resource type="PackedScene" uid="uid://clieeuln36a7a" path="res://Scenes/Actors/Fairy_FSM.tscn" id="104_0bqta"] +[ext_resource type="PackedScene" uid="uid://bq4r28ikbmn0r" path="res://Scenes/Actors/Fairy_Special_FSM.tscn" id="108_cxj4w"] [ext_resource type="PackedScene" uid="uid://ue3i2qyhhtbg" path="res://Scenes/Interactable/control_pad_yellow_keycard.tscn" id="109_j6vrf"] [sub_resource type="Resource" id="Resource_6sau4"] @@ -1363,11 +1364,19 @@ position = Vector2(-927, -159) [node name="FairyGuardFsm15" parent="Parallax2D/Factory Tilemaps/LevelProps" instance=ExtResource("103_f37sa")] position = Vector2(-869, -105) +[node name="KeycardReaderYellow" parent="Parallax2D/Factory Tilemaps/LevelProps" node_paths=PackedStringArray("Targets") instance=ExtResource("109_j6vrf")] +position = Vector2(-1499, -189) +Targets = [NodePath("../HorizontalForceField4")] +ActivationType = 5 + [node name="ControlPad9" parent="Parallax2D/Factory Tilemaps/LevelProps" node_paths=PackedStringArray("Target") instance=ExtResource("12_hfkf1")] position = Vector2(-931, -62) Target = NodePath("../VerticalDoor") ActivationType = 5 +[node name="FairyFsm15" parent="Parallax2D/Factory Tilemaps/LevelProps" instance=ExtResource("108_cxj4w")] +position = Vector2(-687, -53) + [node name="PlayerParent" type="Node2D" parent="Parallax2D/Factory Tilemaps"] [node name="BeamShadows" type="TileMapLayer" parent="Parallax2D/Factory Tilemaps"] @@ -1424,8 +1433,3 @@ AlarmSound = ExtResource("79_jn1m0") process_mode = 3 autoplay = true MusicData = ExtResource("82_ksslq") - -[node name="KeycardReaderYellow" parent="." node_paths=PackedStringArray("Targets") instance=ExtResource("109_j6vrf")] -position = Vector2(-1499, -189) -Targets = [NodePath("../Parallax2D/Factory Tilemaps/LevelProps/HorizontalForceField4")] -ActivationType = 5 diff --git a/Scripts/Bullet.cs b/Scripts/Bullet.cs index c1306e10..5e5c5ab2 100644 --- a/Scripts/Bullet.cs +++ b/Scripts/Bullet.cs @@ -28,6 +28,8 @@ public partial class Bullet : Area2D private GameManager _gameManager; + public bool IsGrazed { get; set; } = false; + [Signal] public delegate void OnDestroyEventHandler(); public void Initialize(BulletInfo bulletInfo, GameManager gameManager) diff --git a/Scripts/Components/BulletSpawner.cs b/Scripts/Components/BulletSpawner.cs index e4e60a34..6af53b90 100644 --- a/Scripts/Components/BulletSpawner.cs +++ b/Scripts/Components/BulletSpawner.cs @@ -102,6 +102,9 @@ public class BulletInfo public PackedScene DestructionParticlesScene { get; set; } public IBulletModifier Modifier { get; set; } public List TimeModifiers { get; set; } = new List(); + + public bool Grazeable { get; set; } + public float GrazeValue { get; set; } #region Laser public bool IsLaser { get; set; } diff --git a/Scripts/Components/FSM/Player/PlayerGrazingModule.cs b/Scripts/Components/FSM/Player/PlayerGrazingModule.cs new file mode 100644 index 00000000..f02fb011 --- /dev/null +++ b/Scripts/Components/FSM/Player/PlayerGrazingModule.cs @@ -0,0 +1,65 @@ +using Cirno.Scripts.Components.Actors; +using Godot; + +namespace Cirno.Scripts.Components.FSM.Player; + +public partial class PlayerGrazingModule : PlayerArea2DModule +{ + [Export] public BulletOwner Owner { get; private set; } = BulletOwner.Player; + + [Export] public ActorResourceProvider Shield { get; private set; } + + private bool _enabled = false; + + public bool Enabled + { + get => _enabled; + set + { + if (_enabled == value) return; + _enabled = value; + } + } + + + public override void EnterState(PlayerState state) + { + Enabled = true; + this.AreaEntered += OnAreaEntered; + } + + private void OnAreaEntered(Area2D area) + { + if (!Enabled) return; + if (area is Bullet bullet) + { + if (bullet.IsGrazed) return; + if (!bullet.BulletInfo.Grazeable) return; + if (bullet.BulletOwner is BulletOwner.Player) return; + + GD.Print("Grazed"); + + bullet.IsGrazed = true; + Shield.CurrentResource += bullet.BulletInfo.GrazeValue; + // check if it's grazed + // check if it's grazeable + // restore appropriate amount of shield + } + } + + public override void ExitState(PlayerState state) + { + Enabled = false; + this.AreaEntered -= OnAreaEntered; + } + + public override void Process(double delta) + { + + } + + public override void PhysicsProcess(double delta) + { + + } +} \ No newline at end of file diff --git a/Scripts/Components/FSM/Player/PlayerGrazingModule.cs.uid b/Scripts/Components/FSM/Player/PlayerGrazingModule.cs.uid new file mode 100644 index 00000000..1e614670 --- /dev/null +++ b/Scripts/Components/FSM/Player/PlayerGrazingModule.cs.uid @@ -0,0 +1 @@ +uid://d2r5eh3wn16bg diff --git a/Scripts/Resources/BulletResource.cs b/Scripts/Resources/BulletResource.cs index 83f93433..aaf0ead8 100644 --- a/Scripts/Resources/BulletResource.cs +++ b/Scripts/Resources/BulletResource.cs @@ -20,6 +20,8 @@ public partial class BulletResource : Resource [Export] public BulletOwner Owner = BulletOwner.None; [Export] public DamageType DamageType = DamageType.Neutral; [Export] public bool Controllable = false; + [Export] public bool Grazeable { get; set; } = true; + [Export] public float GrazeValue { get; set; } = 1f; [Export] public BulletCreationModifier Modifier; @@ -44,7 +46,9 @@ public partial class BulletResource : Resource DestroyOnCollision = DestroyOnCollision, DestructionParticlesScene = DestructionParticlesScene, Controllabe = Controllable, - TimeModifiers = TimeModifiers.Select(x => x).ToList() + TimeModifiers = TimeModifiers.Select(x => x).ToList(), + Grazeable = Grazeable, + GrazeValue = GrazeValue, // TimeModifiers = TimeModifiers?.Where(mod => mod is TimeModifier).Cast().Select(m => new ModifierWrapper() // { // TimeModifier = m, diff --git a/Sprites/Actors/Fairy_Special.aseprite b/Sprites/Actors/Fairy_Special.aseprite new file mode 100644 index 00000000..00450ad6 --- /dev/null +++ b/Sprites/Actors/Fairy_Special.aseprite @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7313f8b9b67ab5b6ea43bf8151beea18780c9a20aebec89ec5fe0850bfebf716 +size 2099 diff --git a/Sprites/Actors/Fairy_Special.png b/Sprites/Actors/Fairy_Special.png new file mode 100644 index 00000000..20a59446 --- /dev/null +++ b/Sprites/Actors/Fairy_Special.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ed7e5353880da9af67749bec32571f9e5d4ab6e2f0876bfbcbf7cb7bea0d9560 +size 548 diff --git a/Sprites/Actors/Fairy_Special.png.import b/Sprites/Actors/Fairy_Special.png.import new file mode 100644 index 00000000..15e03f53 --- /dev/null +++ b/Sprites/Actors/Fairy_Special.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://callpd48wwnlw" +path="res://.godot/imported/Fairy_Special.png-ca9d9981d9f4a3f7175ca0e78f8bafb4.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Sprites/Actors/Fairy_Special.png" +dest_files=["res://.godot/imported/Fairy_Special.png-ca9d9981d9f4a3f7175ca0e78f8bafb4.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