diff --git a/Assets/Fonts/calamity/calamity-spaced.tres b/Assets/Fonts/calamity/calamity-spaced.tres new file mode 100644 index 0000000..f794095 --- /dev/null +++ b/Assets/Fonts/calamity/calamity-spaced.tres @@ -0,0 +1,7 @@ +[gd_resource type="FontVariation" load_steps=2 format=3 uid="uid://cnjpt3yy746ob"] + +[ext_resource type="FontFile" uid="uid://6bvgjbmqovau" path="res://Assets/Fonts/calamity/calamity.ttf" id="1_m4w5i"] + +[resource] +base_font = ExtResource("1_m4w5i") +spacing_glyph = 4 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/Assets/Sprites/UI/border.ase b/Assets/Sprites/UI/border.ase new file mode 100644 index 0000000..f593068 Binary files /dev/null and b/Assets/Sprites/UI/border.ase differ diff --git a/Assets/Sprites/UI/border.png b/Assets/Sprites/UI/border.png new file mode 100644 index 0000000..181cc5e Binary files /dev/null and b/Assets/Sprites/UI/border.png differ diff --git a/Assets/Sprites/UI/border.png.import b/Assets/Sprites/UI/border.png.import new file mode 100644 index 0000000..a35e4e8 --- /dev/null +++ b/Assets/Sprites/UI/border.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cd8ak8gu0104t" +path="res://.godot/imported/border.png-c957ce067800ad93e4d5a5a409cc0f49.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Sprites/UI/border.png" +dest_files=["res://.godot/imported/border.png-c957ce067800ad93e4d5a5a409cc0f49.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 diff --git a/Assets/Sprites/UI/menu-center.ase b/Assets/Sprites/UI/menu-center.ase new file mode 100644 index 0000000..d30e7cd Binary files /dev/null and b/Assets/Sprites/UI/menu-center.ase differ diff --git a/Assets/Sprites/UI/menu-center.png b/Assets/Sprites/UI/menu-center.png new file mode 100644 index 0000000..81d9852 Binary files /dev/null and b/Assets/Sprites/UI/menu-center.png differ diff --git a/Assets/Sprites/UI/menu-center.png.import b/Assets/Sprites/UI/menu-center.png.import new file mode 100644 index 0000000..3b4d29e --- /dev/null +++ b/Assets/Sprites/UI/menu-center.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://t467i5xou4ug" +path="res://.godot/imported/menu-center.png-fa37aff35ac70bec324c3aa847f905cd.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Sprites/UI/menu-center.png" +dest_files=["res://.godot/imported/menu-center.png-fa37aff35ac70bec324c3aa847f905cd.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 diff --git a/Characters/Character.cs b/Characters/Character.cs index 785d11c..9c02342 100644 --- a/Characters/Character.cs +++ b/Characters/Character.cs @@ -30,7 +30,7 @@ public partial class Character : CharacterBody2D, IFaction public float Stealth { get; protected set; } = 0; [Signal] - public delegate void HealthChangedEventHandler(float oldHP, float newHP); + public delegate void HealthChangedEventHandler(Events.HealthChangedArgs args); [Signal] public delegate void HurtEventHandler(Events.HurtArgs args); @@ -60,6 +60,13 @@ public partial class Character : CharacterBody2D, IFaction return; } + var args = new Events.HealthChangedArgs + { + OldHealth = _health, + NewHealth = value, + }; + EmitSignal(SignalName.HealthChanged, args); + _health = value; if (_health <= 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.cs b/Characters/Player.cs index b845271..83c22f9 100644 --- a/Characters/Player.cs +++ b/Characters/Player.cs @@ -40,6 +40,12 @@ public sealed partial class Player : Character AttackAnimation.Play("sword"); } }; + + HealthChanged += (args) => + { + var signal = Events.EventBus.SignalName.PlayerHealthChanged; + this.GetEventBus().EmitSignal(signal, args); + }; } public override void _Input(InputEvent @event) 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/Events/AreaChangedArgs.cs b/Events/AreaChangedArgs.cs new file mode 100644 index 0000000..065103d --- /dev/null +++ b/Events/AreaChangedArgs.cs @@ -0,0 +1,6 @@ +namespace SupaLidlGame.Events; + +public partial class AreaChangedArgs : Args +{ + public Scenes.Map Map { get; set; } +} diff --git a/Events/EventBus.cs b/Events/EventBus.cs index 7a8d46b..2f93bbc 100644 --- a/Events/EventBus.cs +++ b/Events/EventBus.cs @@ -6,4 +6,16 @@ public partial class EventBus : Node { [Signal] public delegate void RequestMoveToAreaEventHandler(RequestAreaArgs args); + + [Signal] + public delegate void AreaChangedEventHandler(Scenes.Map map); + + [Signal] + public delegate void PlayerDeathEventHandler(HurtArgs args); + + [Signal] + public delegate void PlayerHurtEventHandler(HurtArgs args); + + [Signal] + public delegate void PlayerHealthChangedEventHandler(HealthChangedArgs args); } diff --git a/Extensions/Node.cs b/Extensions/Node.cs index d167a2c..34f47b6 100644 --- a/Extensions/Node.cs +++ b/Extensions/Node.cs @@ -66,4 +66,15 @@ public static class NodeExtensions { return node.GetNode("/root/World"); } + + public static CanvasLayer GetUI(this Node node) + { + return node.GetNode("/root/BaseUI"); + } + + public static UI.UIController GetMainUI(this Node node) + { + return node.GetNode("/root/BaseUI/" + + "SubViewportContainer/UIViewport/CanvasLayer/MainUILayer/Main"); + } } 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/Level.tscn b/Scenes/Level.tscn index 28f3a98..e04588f 100644 --- a/Scenes/Level.tscn +++ b/Scenes/Level.tscn @@ -1,82 +1,14 @@ -[gd_scene load_steps=6 format=3 uid="uid://1pb3mpmrl7lc"] +[gd_scene load_steps=3 format=3 uid="uid://1pb3mpmrl7lc"] [ext_resource type="Script" path="res://Utils/World.cs" id="1_1k6ew"] -[ext_resource type="PackedScene" uid="uid://bxo553hblp6nf" path="res://UI/HealthBar.tscn" id="3_5rhge"] -[ext_resource type="Script" path="res://UI/UIController.cs" id="3_fe62s"] -[ext_resource type="PackedScene" uid="uid://01d24ij5av1y" path="res://UI/BossBar.tscn" id="5_8njq4"] -[ext_resource type="PackedScene" uid="uid://73jm5qjy52vq" path="res://Dialogue/balloon.tscn" id="6_2bdwl"] +[ext_resource type="PackedScene" uid="uid://c271rdjhd1gfo" path="res://UI/Base.tscn" id="2_mm0qt"] -[node name="World" type="Node2D" node_paths=PackedStringArray("UIController", "MusicPlayer", "DialogueBalloon")] +[node name="World" type="Node2D" node_paths=PackedStringArray("MusicPlayer", "DialogueBalloon")] script = ExtResource("1_1k6ew") -UIController = NodePath("CanvasLayer/SubViewportContainer/UIViewport/CanvasLayer/UI") MusicPlayer = NodePath("MusicPlayer") DialogueBalloon = NodePath("CanvasLayer/SubViewportContainer/UIViewport/DialogBalloon") -[node name="CanvasLayer" type="CanvasLayer" parent="."] - -[node name="SubViewportContainer" type="SubViewportContainer" parent="CanvasLayer"] -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -stretch = true -stretch_shrink = 3 - -[node name="UIViewport" type="SubViewport" parent="CanvasLayer/SubViewportContainer"] -transparent_bg = true -handle_input_locally = false -size = Vector2i(640, 360) -render_target_update_mode = 4 - -[node name="DialogBalloon" parent="CanvasLayer/SubViewportContainer/UIViewport" instance=ExtResource("6_2bdwl")] -layer = 2 - -[node name="CanvasLayer" type="CanvasLayer" parent="CanvasLayer/SubViewportContainer/UIViewport"] - -[node name="UI" type="Control" parent="CanvasLayer/SubViewportContainer/UIViewport/CanvasLayer" node_paths=PackedStringArray("BossBar")] -z_index = 128 -layout_mode = 3 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -size_flags_horizontal = 3 -size_flags_vertical = 3 -script = ExtResource("3_fe62s") -BossBar = NodePath("Bottom/BossBar") - -[node name="Top" type="HBoxContainer" parent="CanvasLayer/SubViewportContainer/UIViewport/CanvasLayer/UI"] -layout_mode = 1 -anchors_preset = 10 -anchor_right = 1.0 -offset_bottom = 40.0 -grow_horizontal = 2 - -[node name="Margin" type="MarginContainer" parent="CanvasLayer/SubViewportContainer/UIViewport/CanvasLayer/UI/Top"] -layout_mode = 2 -theme_override_constants/margin_left = 16 -theme_override_constants/margin_top = 16 - -[node name="HealthBar" parent="CanvasLayer/SubViewportContainer/UIViewport/CanvasLayer/UI/Top/Margin" instance=ExtResource("3_5rhge")] -layout_mode = 2 -size_flags_horizontal = 3 - -[node name="Bottom" type="HBoxContainer" parent="CanvasLayer/SubViewportContainer/UIViewport/CanvasLayer/UI"] -layout_mode = 1 -anchors_preset = 12 -anchor_top = 1.0 -anchor_right = 1.0 -anchor_bottom = 1.0 -offset_top = -44.0 -grow_horizontal = 2 -grow_vertical = 0 -alignment = 1 - -[node name="BossBar" parent="CanvasLayer/SubViewportContainer/UIViewport/CanvasLayer/UI/Bottom" instance=ExtResource("5_8njq4")] -visible = false -layout_mode = 2 +[node name="CanvasLayer" parent="." instance=ExtResource("2_mm0qt")] [node name="DebugUI" type="CanvasLayer" parent="."] layer = 2 @@ -90,3 +22,4 @@ grow_horizontal = 2 grow_vertical = 2 [node name="MusicPlayer" type="AudioStreamPlayer" parent="."] +bus = &"Music" diff --git a/Scenes/Map.cs b/Scenes/Map.cs index 0999847..908f0c1 100644 --- a/Scenes/Map.cs +++ b/Scenes/Map.cs @@ -39,7 +39,7 @@ public partial class Map : TileMap } set { - _active = Visible = value; + _active = value; SetProcess(value); } } diff --git a/Scenes/Maps/Arena.tscn b/Scenes/Maps/Arena.tscn index 1ebf58e..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_ltk3d"] +[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_ltk3d") +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 24cbf76..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_vw5b5"] +[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_8p2xl"] +[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_ndk4b"] +[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_yll4k"] +[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_yuyxc"] +[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_ecd57"] +[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_ewmj1"] +[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_k255s"] +[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_4sns8"] +[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_w1raa"] +[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) @@ -241,8 +249,8 @@ layer_4/tile_data = PackedInt32Array(2097150, 655360, 2, 2359293, 655360, 1, 235 CameraLowerBound = Vector2(0, 0) CameraUpperBound = Vector2(0, 0) ClearColor = Color(0.105882, 0.0470588, 0.117647, 1) -AreaName = "Depths of the Arena" -MapName = "The Arena" +AreaName = "The Arena" +MapName = "Depths of the Arena" [node name="CanvasModulate" parent="." index="0"] color = Color(0.5, 0.5, 0.5, 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_vw5b5") +material = SubResource("ShaderMaterial_xq8mc") position = Vector2(-360, 31) [node name="Centurion2" parent="Entities" index="8" instance=ExtResource("30_qfl2k")] -material = SubResource("ShaderMaterial_8p2xl") +material = SubResource("ShaderMaterial_w21tu") position = Vector2(-224, 131) [node name="Legionary" parent="Entities" index="9" instance=ExtResource("27_84gw4")] -material = SubResource("ShaderMaterial_ndk4b") +material = SubResource("ShaderMaterial_bgnx0") position = Vector2(-214, 72) [node name="Legionary2" parent="Entities" index="10" instance=ExtResource("27_84gw4")] -material = SubResource("ShaderMaterial_yll4k") +material = SubResource("ShaderMaterial_wpwa5") position = Vector2(-496, 15) [node name="Legionary3" parent="Entities" index="11" instance=ExtResource("27_84gw4")] -material = SubResource("ShaderMaterial_yuyxc") +material = SubResource("ShaderMaterial_nayll") position = Vector2(-240, 152) [node name="Legionary4" parent="Entities" index="12" instance=ExtResource("27_84gw4")] -material = SubResource("ShaderMaterial_ecd57") +material = SubResource("ShaderMaterial_ng6wy") position = Vector2(-300, 384) [node name="Legionary5" parent="Entities" index="13" instance=ExtResource("27_84gw4")] -material = SubResource("ShaderMaterial_ewmj1") +material = SubResource("ShaderMaterial_vxxuo") position = Vector2(-300, 401) [node name="Legionary6" parent="Entities" index="14" instance=ExtResource("27_84gw4")] -material = SubResource("ShaderMaterial_k255s") +material = SubResource("ShaderMaterial_xq55r") position = Vector2(-316, 425) [node name="Legionary7" parent="Entities" index="15" instance=ExtResource("27_84gw4")] -material = SubResource("ShaderMaterial_4sns8") +material = SubResource("ShaderMaterial_1c5jm") position = Vector2(-300, 449) [node name="Legionary8" parent="Entities" index="16" instance=ExtResource("27_84gw4")] -material = SubResource("ShaderMaterial_w1raa") +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/Shaders/Wipe.gdshader b/Shaders/Wipe.gdshader new file mode 100644 index 0000000..7cebd6d --- /dev/null +++ b/Shaders/Wipe.gdshader @@ -0,0 +1,11 @@ +shader_type canvas_item; + +uniform float amount : hint_range(0.5, 1.0, 0.01) = 1; + +void fragment() { + // Place fragment code here. + //COLOR = texture(TEXTURE, UV); + if (UV.x > amount || UV.x < 1.0 - amount) { + COLOR.a = 0.0; + } +} 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; } diff --git a/UI/Base.tscn b/UI/Base.tscn new file mode 100644 index 0000000..7770bdc --- /dev/null +++ b/UI/Base.tscn @@ -0,0 +1,75 @@ +[gd_scene load_steps=6 format=3 uid="uid://c271rdjhd1gfo"] + +[ext_resource type="PackedScene" uid="uid://73jm5qjy52vq" path="res://Dialogue/balloon.tscn" id="1_atjb1"] +[ext_resource type="Script" path="res://UI/UIController.cs" id="2_b4b6l"] +[ext_resource type="PackedScene" uid="uid://bxo553hblp6nf" path="res://UI/HealthBar.tscn" id="3_j1j6h"] +[ext_resource type="PackedScene" uid="uid://01d24ij5av1y" path="res://UI/BossBar.tscn" id="4_igi28"] +[ext_resource type="PackedScene" uid="uid://c77754nvmckn" path="res://UI/LocationDisplay.tscn" id="5_cr6vo"] + +[node name="BaseUI" type="CanvasLayer"] + +[node name="SubViewportContainer" type="SubViewportContainer" parent="."] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +stretch = true +stretch_shrink = 3 + +[node name="UIViewport" type="SubViewport" parent="SubViewportContainer"] +transparent_bg = true +handle_input_locally = false +size = Vector2i(640, 360) +render_target_update_mode = 4 + +[node name="DialogBalloon" parent="SubViewportContainer/UIViewport" instance=ExtResource("1_atjb1")] +layer = 2 + +[node name="MainUILayer" type="CanvasLayer" parent="SubViewportContainer/UIViewport"] + +[node name="Main" type="Control" parent="SubViewportContainer/UIViewport/MainUILayer" node_paths=PackedStringArray("BossBar")] +z_index = 128 +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +script = ExtResource("2_b4b6l") +BossBar = NodePath("Bottom/BossBar") + +[node name="Top" type="HBoxContainer" parent="SubViewportContainer/UIViewport/MainUILayer/Main"] +layout_mode = 1 +anchors_preset = 10 +anchor_right = 1.0 +offset_bottom = 40.0 +grow_horizontal = 2 + +[node name="Margin" type="MarginContainer" parent="SubViewportContainer/UIViewport/MainUILayer/Main/Top"] +layout_mode = 2 +theme_override_constants/margin_left = 16 +theme_override_constants/margin_top = 16 + +[node name="HealthBar" parent="SubViewportContainer/UIViewport/MainUILayer/Main/Top/Margin" instance=ExtResource("3_j1j6h")] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="Bottom" type="HBoxContainer" parent="SubViewportContainer/UIViewport/MainUILayer/Main"] +layout_mode = 1 +anchors_preset = 12 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_top = -44.0 +grow_horizontal = 2 +grow_vertical = 0 +alignment = 1 + +[node name="BossBar" parent="SubViewportContainer/UIViewport/MainUILayer/Main/Bottom" instance=ExtResource("4_igi28")] +visible = false +layout_mode = 2 + +[node name="LocationDisplay" parent="SubViewportContainer/UIViewport/MainUILayer" instance=ExtResource("5_cr6vo")] diff --git a/UI/HealthBar.cs b/UI/HealthBar.cs index 896e59a..79345fd 100644 --- a/UI/HealthBar.cs +++ b/UI/HealthBar.cs @@ -1,4 +1,5 @@ using Godot; +using SupaLidlGame.Extensions; namespace SupaLidlGame.UI; @@ -9,5 +10,9 @@ public partial class HealthBar : Control public override void _Ready() { ProgressBar = GetNode("TextureProgressBar"); + this.GetEventBus().PlayerHealthChanged += (args) => + { + ProgressBar.Value = args.NewHealth; + }; } } diff --git a/UI/LocationDisplay.cs b/UI/LocationDisplay.cs new file mode 100644 index 0000000..eb3ab8a --- /dev/null +++ b/UI/LocationDisplay.cs @@ -0,0 +1,32 @@ +using Godot; +using SupaLidlGame.Extensions; + +namespace SupaLidlGame.UI; + +public partial class LocationDisplay : CenterContainer +{ + private Label _mapName; + private Label _subtitle; + private AnimationPlayer _animPlayer; + + public override void _Ready() + { + _mapName = GetNode