diff --git a/Assets/Sounds/fire-burst-flash.wav b/Assets/Sounds/fire-burst-flash.wav new file mode 100644 index 0000000..f5406bf Binary files /dev/null and b/Assets/Sounds/fire-burst-flash.wav differ diff --git a/Assets/Sounds/fire-burst-flash.wav.import b/Assets/Sounds/fire-burst-flash.wav.import new file mode 100644 index 0000000..4994a68 --- /dev/null +++ b/Assets/Sounds/fire-burst-flash.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://braj74by0oowo" +path="res://.godot/imported/fire-burst-flash.wav-9c015de28d7fd87270e17866ce60cb91.sample" + +[deps] + +source_file="res://Assets/Sounds/fire-burst-flash.wav" +dest_files=["res://.godot/imported/fire-burst-flash.wav-9c015de28d7fd87270e17866ce60cb91.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/Characters/DocCenturion.tscn b/Characters/DocCenturion.tscn index 56f7b2a..0284afa 100644 --- a/Characters/DocCenturion.tscn +++ b/Characters/DocCenturion.tscn @@ -315,6 +315,7 @@ MaxDistanceToTarget = 128.0 UseItemDistance = 48.0 PassiveState = NodePath("../Idle") PursueState = NodePath("../Idle") +PursueOnLineOfSight = false NPC = NodePath("../..") [node name="Idle" type="Node" parent="ThinkerStateMachine" node_paths=PackedStringArray("PursueState", "NavigationAgent", "NPC")] diff --git a/Characters/doc-cultist.tscn b/Characters/DocCultist.tscn similarity index 95% rename from Characters/doc-cultist.tscn rename to Characters/DocCultist.tscn index 27852da..7f9e868 100644 --- a/Characters/doc-cultist.tscn +++ b/Characters/DocCultist.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=43 format=3 uid="uid://3bcudbixirkj"] +[gd_scene load_steps=44 format=3 uid="uid://3bcudbixirkj"] [ext_resource type="Shader" path="res://Shaders/Flash.gdshader" id="2_2lfeo"] [ext_resource type="Script" path="res://Characters/Enemy.cs" id="2_l16dp"] @@ -10,6 +10,7 @@ [ext_resource type="Script" path="res://State/Thinker/PursueState.cs" id="7_q01ij"] [ext_resource type="Animation" uid="uid://8e8r3y1imvsx" path="res://Assets/Animations/stun.res" id="8_n0iqj"] [ext_resource type="Script" path="res://State/Thinker/AttackState.cs" id="8_woh6n"] +[ext_resource type="Script" path="res://State/Thinker/IdleState.cs" id="9_kypol"] [ext_resource type="Material" uid="uid://bat28samf7ukd" path="res://Assets/Sprites/Particles/NPCDamageProcessMaterial.tres" id="9_x36vb"] [ext_resource type="Texture2D" uid="uid://bd8l8kafb42dt" path="res://Assets/Sprites/Particles/circle.png" id="10_io6bw"] [ext_resource type="Material" uid="uid://2tsvsp45elru" path="res://Assets/Sprites/Particles/NPCDeathParticles.tres" id="10_yyggy"] @@ -422,24 +423,36 @@ Character = NodePath("../..") [node name="ThinkerStateMachine" type="Node" parent="." node_paths=PackedStringArray("InitialState")] script = ExtResource("6_8y4xc") -InitialState = NodePath("Pursue") +InitialState = NodePath("Idle") -[node name="Pursue" type="Node" parent="ThinkerStateMachine" node_paths=PackedStringArray("NavigationAgent", "AttackState", "NPC")] +[node name="Pursue" type="Node" parent="ThinkerStateMachine" node_paths=PackedStringArray("NavigationAgent", "AttackState", "PassiveState", "NPC")] script = ExtResource("7_q01ij") NavigationAgent = NodePath("../../NavigationAgent2D") AttackState = NodePath("../Attack") +PassiveState = NodePath("../Idle") MinDistanceToTarget = 96.0 +MaxDistanceFromOrigin = 256.0 ThinkDelta = 0.05 NPC = NodePath("../..") [node name="Attack" type="Node" parent="ThinkerStateMachine" node_paths=PackedStringArray("PassiveState", "PursueState", "NPC")] script = ExtResource("8_woh6n") MaxDistanceToTarget = 128.0 +UseItemDistance = 128.0 PassiveState = NodePath("../Pursue") PursueState = NodePath("../Pursue") +PursueOnLineOfSight = false NPC = NodePath("../..") -[node name="Idle" type="Node" parent="ThinkerStateMachine"] +[node name="Idle" type="Node" parent="ThinkerStateMachine" node_paths=PackedStringArray("PursueState", "NavigationAgent", "NPC")] +script = ExtResource("9_kypol") +PursueState = NodePath("../Pursue") +MinTargetDistance = 32.0 +PursueOnLineOfSight = true +MinLineOfSightDistance = 128.0 +ShouldReturnToOriginalPosition = true +NavigationAgent = NodePath("../../NavigationAgent2D") +NPC = NodePath("../..") [node name="NavigationAgent2D" type="NavigationAgent2D" parent="."] debug_enabled = true @@ -524,6 +537,7 @@ script = ExtResource("17_sjq8t") [node name="ProjectileSpawner" parent="Inventory" instance=ExtResource("17_dmlbb")] Projectile = ExtResource("18_lwg36") ShouldOverrideProjectileDamage = false +ShouldOverrideVelocity = false ShouldRotate = false UseTime = 2.0 diff --git a/Characters/NPC.cs b/Characters/NPC.cs index 4f761c2..1143e5d 100644 --- a/Characters/NPC.cs +++ b/Characters/NPC.cs @@ -90,10 +90,7 @@ public partial class NPC : Character { if (AttackAnimation is not null) { - if (AttackAnimation.HasAnimation("attack")) - { - AttackAnimation.Play("attack"); - } + AttackAnimation.TryPlay("attack"); } } }; diff --git a/Characters/Player.tscn b/Characters/Player.tscn index 68f9cf7..0c0242a 100644 --- a/Characters/Player.tscn +++ b/Characters/Player.tscn @@ -324,7 +324,6 @@ script = ExtResource("1_flygr") Camera = NodePath("Camera2D") DirectionMarker = NodePath("Direction2D") Speed = 80.0 -Stealth = 1.0 HandTexture = ExtResource("3_3dqh7") Sprite = NodePath("Sprites/Node2D/Character") Inventory = NodePath("Inventory") diff --git a/Entities/UnwantedFrequency.cs b/Entities/UnwantedFrequency.cs index 27a2146..fe4243c 100644 --- a/Entities/UnwantedFrequency.cs +++ b/Entities/UnwantedFrequency.cs @@ -12,10 +12,14 @@ public partial class UnwantedFrequency : Projectile, Utils.ITarget public Utils.Trail Trail { get; private set; } + public Utils.Trail Trail2 { get; private set; } + public Node2D TrailRotation { get; private set; } public Node2D TrailPosition { get; private set; } + public Node2D TrailPosition2 { get; private set; } + public GpuParticles2D DeathParticles { get; private set; } public GpuParticles2D SpawnParticles { get; private set; } @@ -30,7 +34,9 @@ public partial class UnwantedFrequency : Projectile, Utils.ITarget { TrailRotation = GetNode("TrailRotation"); TrailPosition = TrailRotation.GetNode("TrailPosition"); + TrailPosition2 = TrailRotation.GetNode("TrailPosition2"); Trail = TrailPosition.GetNode("Trail"); + Trail2 = TrailPosition2.GetNode("Trail"); DeferDeathTimer = GetNode("DeferDeath"); DeathParticles = GetNode("DeathParticles"); SpawnParticles = GetNode("SpawnParticles"); @@ -51,6 +57,7 @@ public partial class UnwantedFrequency : Projectile, Utils.ITarget float radians = (float)_currentLifetime * 24; TrailRotation.Rotation = Direction.Angle(); TrailPosition.Position = new Vector2(0, 4 * Mathf.Sin(radians)); + TrailPosition2.Position = -TrailPosition.Position; if (CharacterTarget is not null) { @@ -64,7 +71,7 @@ public partial class UnwantedFrequency : Projectile, Utils.ITarget public override void Die() { - IsDead = Trail.IsDead = true; + IsDead = Trail.IsDead = Trail2.IsDead = true; Hitbox.SetDeferred("monitoring", false); DeferDeathTimer.Timeout += () => { diff --git a/Entities/UnwantedFrequency.tscn b/Entities/UnwantedFrequency.tscn index c1b4e30..9032d58 100644 --- a/Entities/UnwantedFrequency.tscn +++ b/Entities/UnwantedFrequency.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=22 format=3 uid="uid://1y5r6sklwgrp"] +[gd_scene load_steps=24 format=3 uid="uid://1y5r6sklwgrp"] [ext_resource type="Script" path="res://Entities/UnwantedFrequency.cs" id="1_6sbe0"] [ext_resource type="PackedScene" uid="uid://du5vhccg75nrq" path="res://BoundingBoxes/Hitbox.tscn" id="2_gxtvd"] [ext_resource type="PackedScene" uid="uid://cojxmcin13ihm" path="res://Utils/Trail.tscn" id="3_67uhs"] [ext_resource type="AudioStream" uid="uid://cn2wop7rfxku8" path="res://Assets/Sounds/karabast.mp3" id="4_pbgsi"] +[ext_resource type="AudioStream" uid="uid://braj74by0oowo" path="res://Assets/Sounds/fire-burst-flash.wav" id="5_6tm7d"] [ext_resource type="Texture2D" uid="uid://c1a7lvb4uuwfy" path="res://Assets/Sprites/Particles/circle-16.png" id="5_qbbx7"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_30y8q"] @@ -17,6 +18,10 @@ point_count = 2 offsets = PackedFloat32Array(0.00662252, 0.715232, 1) colors = PackedColorArray(0.996078, 0, 0.164706, 0, 0.996045, 0, 0.166638, 1, 1, 1, 1, 1) +[sub_resource type="Gradient" id="Gradient_m1y6u"] +offsets = PackedFloat32Array(0.00662252, 0.715232, 1) +colors = PackedColorArray(0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1) + [sub_resource type="Gradient" id="Gradient_2q0ut"] offsets = PackedFloat32Array(0.525926, 0.740741, 1) colors = PackedColorArray(1, 1, 1, 1, 1, 0.00784314, 0.215686, 0.784314, 1, 0, 0, 0) @@ -121,7 +126,6 @@ Delay = 1.0 [node name="Hitbox" parent="." instance=ExtResource("2_gxtvd")] collision_layer = 0 monitorable = false -priority = 5 Damage = 12.0 Knockback = 324.0 @@ -144,6 +148,19 @@ end_cap_mode = 2 MaximumPoints = 64 Frequency = 30 +[node name="TrailPosition2" type="Node2D" parent="TrailRotation"] + +[node name="Trail" parent="TrailRotation/TrailPosition2" instance=ExtResource("3_67uhs")] +self_modulate = Color(2, 2, 2, 1) +width = 2.0 +width_curve = SubResource("Curve_eu273") +gradient = SubResource("Gradient_m1y6u") +joint_mode = 2 +begin_cap_mode = 2 +end_cap_mode = 2 +MaximumPoints = 64 +Frequency = 30 + [node name="DeferDeath" type="Timer" parent="."] wait_time = 4.0 @@ -153,6 +170,14 @@ volume_db = -16.0 autoplay = true max_distance = 64.0 attenuation = 8.0 +bus = &"Effects" + +[node name="Burst" type="AudioStreamPlayer2D" parent="."] +stream = ExtResource("5_6tm7d") +autoplay = true +max_distance = 512.0 +attenuation = 4.0 +bus = &"Effects" [node name="SpawnParticles" type="GPUParticles2D" parent="."] emitting = false diff --git a/Items/Weapons/ProjectileSpawner.cs b/Items/Weapons/ProjectileSpawner.cs index fb0a800..453e598 100644 --- a/Items/Weapons/ProjectileSpawner.cs +++ b/Items/Weapons/ProjectileSpawner.cs @@ -23,7 +23,11 @@ public partial class ProjectileSpawner : Ranged projectile.Hitbox.Faction = Character.Faction; projectile.Direction = Character.Target.Normalized(); projectile.GlobalPosition = GlobalPosition; - projectile.Speed = InitialVelocity; + + if (ShouldOverrideVelocity) + { + projectile.Speed = InitialVelocity; + } if (ShouldRotate) { @@ -45,5 +49,7 @@ public partial class ProjectileSpawner : Ranged target.CharacterTarget = npc.FindBestTarget(); } } + + Character.Inventory.EmitSignal("UsedItem", this); } } diff --git a/Items/Weapons/Pugio.tscn b/Items/Weapons/Pugio.tscn index b4631d7..eb037f8 100644 --- a/Items/Weapons/Pugio.tscn +++ b/Items/Weapons/Pugio.tscn @@ -473,7 +473,6 @@ hframes = 3 [node name="RemoteTransform2D" type="RemoteTransform2D" parent="Node"] top_level = true -remote_path = NodePath("../../Shield") update_position = false [node name="Shield" type="Sprite2D" parent="."] diff --git a/Scenes/Maps/Arena.tscn b/Scenes/Maps/Arena.tscn index f647150..17a6a79 100644 --- a/Scenes/Maps/Arena.tscn +++ b/Scenes/Maps/Arena.tscn @@ -11,7 +11,7 @@ [ext_resource type="PackedScene" uid="uid://dldnp8eunxj3q" path="res://BoundingBoxes/InteractionTrigger.tscn" id="9_3401j"] [ext_resource type="Script" path="res://BoundingBoxes/ConnectorBox.cs" id="9_fg062"] -[sub_resource type="ShaderMaterial" id="ShaderMaterial_7dryp"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_eas6j"] resource_local_to_scene = true shader = ExtResource("5_h8k5p") shader_parameter/color = Vector4(1, 1, 1, 1) @@ -113,7 +113,7 @@ visible = false position = Vector2(120, -112) [node name="Doc" parent="Entities" index="0" instance=ExtResource("4_ej0f3")] -material = SubResource("ShaderMaterial_7dryp") +material = SubResource("ShaderMaterial_eas6j") [node name="PointLight2D" type="PointLight2D" parent="Entities" index="1"] position = Vector2(168, -42) diff --git a/Scenes/Maps/ArenaExterior.tscn b/Scenes/Maps/ArenaExterior.tscn index 842a50e..36ef66b 100644 --- a/Scenes/Maps/ArenaExterior.tscn +++ b/Scenes/Maps/ArenaExterior.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=59 format=3 uid="uid://dr3bcvql7burk"] +[gd_scene load_steps=61 format=3 uid="uid://dr3bcvql7burk"] [ext_resource type="PackedScene" uid="uid://clwv2owvk6abe" path="res://Scenes/BaseMap.tscn" id="1_ci4ij"] [ext_resource type="TileSet" uid="uid://l61kbx31ug4p" path="res://Scenes/Maps/ArenaTileset.tres" id="2_m6h7j"] @@ -29,6 +29,7 @@ [ext_resource type="PackedScene" uid="uid://cdj50hb84aujp" path="res://Characters/DocLegionary.tscn" id="27_84gw4"] [ext_resource type="Shader" path="res://Shaders/Flash.gdshader" id="28_b3suq"] [ext_resource type="PackedScene" uid="uid://dhamcei7tfta8" path="res://Characters/DocCenturion.tscn" id="30_qfl2k"] +[ext_resource type="PackedScene" uid="uid://3bcudbixirkj" path="res://Characters/DocCultist.tscn" id="30_xj4yo"] [sub_resource type="Gradient" id="Gradient_jupxw"] offsets = PackedFloat32Array(0.00740741, 0.2, 1) @@ -161,70 +162,77 @@ size = Vector2(64, 97) [sub_resource type="RectangleShape2D" id="RectangleShape2D_5pcme"] size = Vector2(18, 6) -[sub_resource type="ShaderMaterial" id="ShaderMaterial_1q1be"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_xq8mc"] resource_local_to_scene = true shader = ExtResource("28_b3suq") shader_parameter/color = Vector4(1, 1, 1, 1) shader_parameter/intensity = 0.0 shader_parameter/alpha_modulate = 1.0 -[sub_resource type="ShaderMaterial" id="ShaderMaterial_obny8"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_w21tu"] resource_local_to_scene = true shader = ExtResource("28_b3suq") shader_parameter/color = Vector4(1, 1, 1, 1) shader_parameter/intensity = 0.0 shader_parameter/alpha_modulate = 1.0 -[sub_resource type="ShaderMaterial" id="ShaderMaterial_exlka"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_bgnx0"] resource_local_to_scene = true shader = ExtResource("28_b3suq") shader_parameter/color = Vector4(1, 1, 1, 1) shader_parameter/intensity = 0.0 shader_parameter/alpha_modulate = 1.0 -[sub_resource type="ShaderMaterial" id="ShaderMaterial_ec2v5"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_wpwa5"] resource_local_to_scene = true shader = ExtResource("28_b3suq") shader_parameter/color = Vector4(1, 1, 1, 1) shader_parameter/intensity = 0.0 shader_parameter/alpha_modulate = 1.0 -[sub_resource type="ShaderMaterial" id="ShaderMaterial_ohpa0"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_nayll"] resource_local_to_scene = true shader = ExtResource("28_b3suq") shader_parameter/color = Vector4(1, 1, 1, 1) shader_parameter/intensity = 0.0 shader_parameter/alpha_modulate = 1.0 -[sub_resource type="ShaderMaterial" id="ShaderMaterial_aiu1q"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_ng6wy"] resource_local_to_scene = true shader = ExtResource("28_b3suq") shader_parameter/color = Vector4(1, 1, 1, 1) shader_parameter/intensity = 0.0 shader_parameter/alpha_modulate = 1.0 -[sub_resource type="ShaderMaterial" id="ShaderMaterial_bf84d"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_vxxuo"] resource_local_to_scene = true shader = ExtResource("28_b3suq") shader_parameter/color = Vector4(1, 1, 1, 1) shader_parameter/intensity = 0.0 shader_parameter/alpha_modulate = 1.0 -[sub_resource type="ShaderMaterial" id="ShaderMaterial_7skkn"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_xq55r"] resource_local_to_scene = true shader = ExtResource("28_b3suq") shader_parameter/color = Vector4(1, 1, 1, 1) shader_parameter/intensity = 0.0 shader_parameter/alpha_modulate = 1.0 -[sub_resource type="ShaderMaterial" id="ShaderMaterial_soae1"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_1c5jm"] resource_local_to_scene = true shader = ExtResource("28_b3suq") shader_parameter/color = Vector4(1, 1, 1, 1) shader_parameter/intensity = 0.0 shader_parameter/alpha_modulate = 1.0 -[sub_resource type="ShaderMaterial" id="ShaderMaterial_to8fm"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_r6iyg"] +resource_local_to_scene = true +shader = ExtResource("28_b3suq") +shader_parameter/color = Vector4(1, 1, 1, 1) +shader_parameter/intensity = 0.0 +shader_parameter/alpha_modulate = 1.0 + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_3ca81"] resource_local_to_scene = true shader = ExtResource("28_b3suq") shader_parameter/color = Vector4(1, 1, 1, 1) @@ -677,45 +685,49 @@ position = Vector2(256, -9) position = Vector2(80, 373) [node name="Centurion" parent="Entities" index="7" instance=ExtResource("30_qfl2k")] -material = SubResource("ShaderMaterial_1q1be") +material = SubResource("ShaderMaterial_xq8mc") position = Vector2(-360, 31) [node name="Centurion2" parent="Entities" index="8" instance=ExtResource("30_qfl2k")] -material = SubResource("ShaderMaterial_obny8") +material = SubResource("ShaderMaterial_w21tu") position = Vector2(-224, 131) [node name="Legionary" parent="Entities" index="9" instance=ExtResource("27_84gw4")] -material = SubResource("ShaderMaterial_exlka") +material = SubResource("ShaderMaterial_bgnx0") position = Vector2(-214, 72) [node name="Legionary2" parent="Entities" index="10" instance=ExtResource("27_84gw4")] -material = SubResource("ShaderMaterial_ec2v5") +material = SubResource("ShaderMaterial_wpwa5") position = Vector2(-496, 15) [node name="Legionary3" parent="Entities" index="11" instance=ExtResource("27_84gw4")] -material = SubResource("ShaderMaterial_ohpa0") +material = SubResource("ShaderMaterial_nayll") position = Vector2(-240, 152) [node name="Legionary4" parent="Entities" index="12" instance=ExtResource("27_84gw4")] -material = SubResource("ShaderMaterial_aiu1q") +material = SubResource("ShaderMaterial_ng6wy") position = Vector2(-300, 384) [node name="Legionary5" parent="Entities" index="13" instance=ExtResource("27_84gw4")] -material = SubResource("ShaderMaterial_bf84d") +material = SubResource("ShaderMaterial_vxxuo") position = Vector2(-300, 401) [node name="Legionary6" parent="Entities" index="14" instance=ExtResource("27_84gw4")] -material = SubResource("ShaderMaterial_7skkn") +material = SubResource("ShaderMaterial_xq55r") position = Vector2(-316, 425) [node name="Legionary7" parent="Entities" index="15" instance=ExtResource("27_84gw4")] -material = SubResource("ShaderMaterial_soae1") +material = SubResource("ShaderMaterial_1c5jm") position = Vector2(-300, 449) [node name="Legionary8" parent="Entities" index="16" instance=ExtResource("27_84gw4")] -material = SubResource("ShaderMaterial_to8fm") +material = SubResource("ShaderMaterial_r6iyg") position = Vector2(-404, 505) +[node name="Cultist" parent="Entities" index="17" instance=ExtResource("30_xj4yo")] +material = SubResource("ShaderMaterial_3ca81") +position = Vector2(191, 567) + [editable path="Props/StaticBookshelf"] [editable path="Props/StaticBookshelf/InteractionTrigger"] [editable path="Props/StaticBookshelf2"] diff --git a/State/Thinker/AttackState.cs b/State/Thinker/AttackState.cs index eec8f91..e34fe3a 100644 --- a/State/Thinker/AttackState.cs +++ b/State/Thinker/AttackState.cs @@ -40,6 +40,9 @@ public partial class AttackState : ThinkerState [Export] public ThinkerState PursueState { get; set; } + [Export] + public bool PursueOnLineOfSight { get; set; } = true; + protected Characters.Character _bestTarget; protected float _preferredWeightDistance = 64.0f; @@ -167,7 +170,12 @@ public partial class AttackState : ThinkerState if (PursueState is not null) { // pursue the player if they can not be seen or is too far away - if (dist > MaxDistanceToTarget || !NPC.HasLineOfSight(bestTarget)) + if (dist > MaxDistanceToTarget) + { + return PursueState; + } + + if (PursueOnLineOfSight && !NPC.HasLineOfSight(bestTarget)) { return PursueState; }