Merge branch 'master' into controller-support

pull/6/head
John Montagu, the 4th Earl of Sandvich 2023-08-14 14:08:58 -07:00
commit ccac1c03da
Signed by: sandvich
GPG Key ID: 9A39BE37E602B22D
34 changed files with 644 additions and 123 deletions

View File

@ -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

Binary file not shown.

View File

@ -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

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 B

View File

@ -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

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 480 B

View File

@ -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

View File

@ -30,7 +30,7 @@ public partial class Character : CharacterBody2D, IFaction
public float Stealth { get; protected set; } = 0; public float Stealth { get; protected set; } = 0;
[Signal] [Signal]
public delegate void HealthChangedEventHandler(float oldHP, float newHP); public delegate void HealthChangedEventHandler(Events.HealthChangedArgs args);
[Signal] [Signal]
public delegate void HurtEventHandler(Events.HurtArgs args); public delegate void HurtEventHandler(Events.HurtArgs args);
@ -60,6 +60,13 @@ public partial class Character : CharacterBody2D, IFaction
return; return;
} }
var args = new Events.HealthChangedArgs
{
OldHealth = _health,
NewHealth = value,
};
EmitSignal(SignalName.HealthChanged, args);
_health = value; _health = value;
if (_health <= 0) if (_health <= 0)
{ {

View File

@ -315,6 +315,7 @@ MaxDistanceToTarget = 128.0
UseItemDistance = 48.0 UseItemDistance = 48.0
PassiveState = NodePath("../Idle") PassiveState = NodePath("../Idle")
PursueState = NodePath("../Idle") PursueState = NodePath("../Idle")
PursueOnLineOfSight = false
NPC = NodePath("../..") NPC = NodePath("../..")
[node name="Idle" type="Node" parent="ThinkerStateMachine" node_paths=PackedStringArray("PursueState", "NavigationAgent", "NPC")] [node name="Idle" type="Node" parent="ThinkerStateMachine" node_paths=PackedStringArray("PursueState", "NavigationAgent", "NPC")]

View File

@ -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="Shader" path="res://Shaders/Flash.gdshader" id="2_2lfeo"]
[ext_resource type="Script" path="res://Characters/Enemy.cs" id="2_l16dp"] [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="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="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/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="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="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"] [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")] [node name="ThinkerStateMachine" type="Node" parent="." node_paths=PackedStringArray("InitialState")]
script = ExtResource("6_8y4xc") 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") script = ExtResource("7_q01ij")
NavigationAgent = NodePath("../../NavigationAgent2D") NavigationAgent = NodePath("../../NavigationAgent2D")
AttackState = NodePath("../Attack") AttackState = NodePath("../Attack")
PassiveState = NodePath("../Idle")
MinDistanceToTarget = 96.0 MinDistanceToTarget = 96.0
MaxDistanceFromOrigin = 256.0
ThinkDelta = 0.05 ThinkDelta = 0.05
NPC = NodePath("../..") NPC = NodePath("../..")
[node name="Attack" type="Node" parent="ThinkerStateMachine" node_paths=PackedStringArray("PassiveState", "PursueState", "NPC")] [node name="Attack" type="Node" parent="ThinkerStateMachine" node_paths=PackedStringArray("PassiveState", "PursueState", "NPC")]
script = ExtResource("8_woh6n") script = ExtResource("8_woh6n")
MaxDistanceToTarget = 128.0 MaxDistanceToTarget = 128.0
UseItemDistance = 128.0
PassiveState = NodePath("../Pursue") PassiveState = NodePath("../Pursue")
PursueState = NodePath("../Pursue") PursueState = NodePath("../Pursue")
PursueOnLineOfSight = false
NPC = NodePath("../..") 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="."] [node name="NavigationAgent2D" type="NavigationAgent2D" parent="."]
debug_enabled = true debug_enabled = true
@ -524,6 +537,7 @@ script = ExtResource("17_sjq8t")
[node name="ProjectileSpawner" parent="Inventory" instance=ExtResource("17_dmlbb")] [node name="ProjectileSpawner" parent="Inventory" instance=ExtResource("17_dmlbb")]
Projectile = ExtResource("18_lwg36") Projectile = ExtResource("18_lwg36")
ShouldOverrideProjectileDamage = false ShouldOverrideProjectileDamage = false
ShouldOverrideVelocity = false
ShouldRotate = false ShouldRotate = false
UseTime = 2.0 UseTime = 2.0

View File

@ -90,10 +90,7 @@ public partial class NPC : Character
{ {
if (AttackAnimation is not null) if (AttackAnimation is not null)
{ {
if (AttackAnimation.HasAnimation("attack")) AttackAnimation.TryPlay("attack");
{
AttackAnimation.Play("attack");
}
} }
} }
}; };

View File

@ -40,6 +40,12 @@ public sealed partial class Player : Character
AttackAnimation.Play("sword"); AttackAnimation.Play("sword");
} }
}; };
HealthChanged += (args) =>
{
var signal = Events.EventBus.SignalName.PlayerHealthChanged;
this.GetEventBus().EmitSignal(signal, args);
};
} }
public override void _Input(InputEvent @event) public override void _Input(InputEvent @event)

View File

@ -324,7 +324,6 @@ script = ExtResource("1_flygr")
Camera = NodePath("Camera2D") Camera = NodePath("Camera2D")
DirectionMarker = NodePath("Direction2D") DirectionMarker = NodePath("Direction2D")
Speed = 80.0 Speed = 80.0
Stealth = 1.0
HandTexture = ExtResource("3_3dqh7") HandTexture = ExtResource("3_3dqh7")
Sprite = NodePath("Sprites/Node2D/Character") Sprite = NodePath("Sprites/Node2D/Character")
Inventory = NodePath("Inventory") Inventory = NodePath("Inventory")

View File

@ -12,10 +12,14 @@ public partial class UnwantedFrequency : Projectile, Utils.ITarget
public Utils.Trail Trail { get; private set; } public Utils.Trail Trail { get; private set; }
public Utils.Trail Trail2 { get; private set; }
public Node2D TrailRotation { get; private set; } public Node2D TrailRotation { get; private set; }
public Node2D TrailPosition { get; private set; } public Node2D TrailPosition { get; private set; }
public Node2D TrailPosition2 { get; private set; }
public GpuParticles2D DeathParticles { get; private set; } public GpuParticles2D DeathParticles { get; private set; }
public GpuParticles2D SpawnParticles { get; private set; } public GpuParticles2D SpawnParticles { get; private set; }
@ -30,7 +34,9 @@ public partial class UnwantedFrequency : Projectile, Utils.ITarget
{ {
TrailRotation = GetNode<Node2D>("TrailRotation"); TrailRotation = GetNode<Node2D>("TrailRotation");
TrailPosition = TrailRotation.GetNode<Node2D>("TrailPosition"); TrailPosition = TrailRotation.GetNode<Node2D>("TrailPosition");
TrailPosition2 = TrailRotation.GetNode<Node2D>("TrailPosition2");
Trail = TrailPosition.GetNode<Utils.Trail>("Trail"); Trail = TrailPosition.GetNode<Utils.Trail>("Trail");
Trail2 = TrailPosition2.GetNode<Utils.Trail>("Trail");
DeferDeathTimer = GetNode<Timer>("DeferDeath"); DeferDeathTimer = GetNode<Timer>("DeferDeath");
DeathParticles = GetNode<GpuParticles2D>("DeathParticles"); DeathParticles = GetNode<GpuParticles2D>("DeathParticles");
SpawnParticles = GetNode<GpuParticles2D>("SpawnParticles"); SpawnParticles = GetNode<GpuParticles2D>("SpawnParticles");
@ -51,6 +57,7 @@ public partial class UnwantedFrequency : Projectile, Utils.ITarget
float radians = (float)_currentLifetime * 24; float radians = (float)_currentLifetime * 24;
TrailRotation.Rotation = Direction.Angle(); TrailRotation.Rotation = Direction.Angle();
TrailPosition.Position = new Vector2(0, 4 * Mathf.Sin(radians)); TrailPosition.Position = new Vector2(0, 4 * Mathf.Sin(radians));
TrailPosition2.Position = -TrailPosition.Position;
if (CharacterTarget is not null) if (CharacterTarget is not null)
{ {
@ -64,7 +71,7 @@ public partial class UnwantedFrequency : Projectile, Utils.ITarget
public override void Die() public override void Die()
{ {
IsDead = Trail.IsDead = true; IsDead = Trail.IsDead = Trail2.IsDead = true;
Hitbox.SetDeferred("monitoring", false); Hitbox.SetDeferred("monitoring", false);
DeferDeathTimer.Timeout += () => DeferDeathTimer.Timeout += () =>
{ {

View File

@ -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="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://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="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://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"] [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"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_30y8q"]
@ -17,6 +18,10 @@ point_count = 2
offsets = PackedFloat32Array(0.00662252, 0.715232, 1) 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) 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"] [sub_resource type="Gradient" id="Gradient_2q0ut"]
offsets = PackedFloat32Array(0.525926, 0.740741, 1) offsets = PackedFloat32Array(0.525926, 0.740741, 1)
colors = PackedColorArray(1, 1, 1, 1, 1, 0.00784314, 0.215686, 0.784314, 1, 0, 0, 0) 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")] [node name="Hitbox" parent="." instance=ExtResource("2_gxtvd")]
collision_layer = 0 collision_layer = 0
monitorable = false monitorable = false
priority = 5
Damage = 12.0 Damage = 12.0
Knockback = 324.0 Knockback = 324.0
@ -144,6 +148,19 @@ end_cap_mode = 2
MaximumPoints = 64 MaximumPoints = 64
Frequency = 30 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="."] [node name="DeferDeath" type="Timer" parent="."]
wait_time = 4.0 wait_time = 4.0
@ -153,6 +170,14 @@ volume_db = -16.0
autoplay = true autoplay = true
max_distance = 64.0 max_distance = 64.0
attenuation = 8.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="."] [node name="SpawnParticles" type="GPUParticles2D" parent="."]
emitting = false emitting = false

View File

@ -0,0 +1,6 @@
namespace SupaLidlGame.Events;
public partial class AreaChangedArgs : Args
{
public Scenes.Map Map { get; set; }
}

View File

@ -6,4 +6,16 @@ public partial class EventBus : Node
{ {
[Signal] [Signal]
public delegate void RequestMoveToAreaEventHandler(RequestAreaArgs args); 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);
} }

View File

@ -66,4 +66,15 @@ public static class NodeExtensions
{ {
return node.GetNode<Utils.World>("/root/World"); return node.GetNode<Utils.World>("/root/World");
} }
public static CanvasLayer GetUI(this Node node)
{
return node.GetNode<CanvasLayer>("/root/BaseUI");
}
public static UI.UIController GetMainUI(this Node node)
{
return node.GetNode<UI.UIController>("/root/BaseUI/" +
"SubViewportContainer/UIViewport/CanvasLayer/MainUILayer/Main");
}
} }

View File

@ -23,7 +23,11 @@ public partial class ProjectileSpawner : Ranged
projectile.Hitbox.Faction = Character.Faction; projectile.Hitbox.Faction = Character.Faction;
projectile.Direction = Character.Target.Normalized(); projectile.Direction = Character.Target.Normalized();
projectile.GlobalPosition = GlobalPosition; projectile.GlobalPosition = GlobalPosition;
if (ShouldOverrideVelocity)
{
projectile.Speed = InitialVelocity; projectile.Speed = InitialVelocity;
}
if (ShouldRotate) if (ShouldRotate)
{ {
@ -45,5 +49,7 @@ public partial class ProjectileSpawner : Ranged
target.CharacterTarget = npc.FindBestTarget(); target.CharacterTarget = npc.FindBestTarget();
} }
} }
Character.Inventory.EmitSignal("UsedItem", this);
} }
} }

View File

@ -473,7 +473,6 @@ hframes = 3
[node name="RemoteTransform2D" type="RemoteTransform2D" parent="Node"] [node name="RemoteTransform2D" type="RemoteTransform2D" parent="Node"]
top_level = true top_level = true
remote_path = NodePath("../../Shield")
update_position = false update_position = false
[node name="Shield" type="Sprite2D" parent="."] [node name="Shield" type="Sprite2D" parent="."]

View File

@ -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="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="PackedScene" uid="uid://c271rdjhd1gfo" path="res://UI/Base.tscn" id="2_mm0qt"]
[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"]
[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") script = ExtResource("1_1k6ew")
UIController = NodePath("CanvasLayer/SubViewportContainer/UIViewport/CanvasLayer/UI")
MusicPlayer = NodePath("MusicPlayer") MusicPlayer = NodePath("MusicPlayer")
DialogueBalloon = NodePath("CanvasLayer/SubViewportContainer/UIViewport/DialogBalloon") DialogueBalloon = NodePath("CanvasLayer/SubViewportContainer/UIViewport/DialogBalloon")
[node name="CanvasLayer" type="CanvasLayer" parent="."] [node name="CanvasLayer" parent="." instance=ExtResource("2_mm0qt")]
[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="DebugUI" type="CanvasLayer" parent="."] [node name="DebugUI" type="CanvasLayer" parent="."]
layer = 2 layer = 2
@ -90,3 +22,4 @@ grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
[node name="MusicPlayer" type="AudioStreamPlayer" parent="."] [node name="MusicPlayer" type="AudioStreamPlayer" parent="."]
bus = &"Music"

View File

@ -39,7 +39,7 @@ public partial class Map : TileMap
} }
set set
{ {
_active = Visible = value; _active = value;
SetProcess(value); SetProcess(value);
} }
} }

View File

@ -11,7 +11,7 @@
[ext_resource type="PackedScene" uid="uid://dldnp8eunxj3q" path="res://BoundingBoxes/InteractionTrigger.tscn" id="9_3401j"] [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"] [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 resource_local_to_scene = true
shader = ExtResource("5_h8k5p") shader = ExtResource("5_h8k5p")
shader_parameter/color = Vector4(1, 1, 1, 1) shader_parameter/color = Vector4(1, 1, 1, 1)
@ -113,7 +113,7 @@ visible = false
position = Vector2(120, -112) position = Vector2(120, -112)
[node name="Doc" parent="Entities" index="0" instance=ExtResource("4_ej0f3")] [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"] [node name="PointLight2D" type="PointLight2D" parent="Entities" index="1"]
position = Vector2(168, -42) position = Vector2(168, -42)

View File

@ -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="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"] [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="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="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://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"] [sub_resource type="Gradient" id="Gradient_jupxw"]
offsets = PackedFloat32Array(0.00740741, 0.2, 1) offsets = PackedFloat32Array(0.00740741, 0.2, 1)
@ -161,70 +162,77 @@ size = Vector2(64, 97)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_5pcme"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_5pcme"]
size = Vector2(18, 6) size = Vector2(18, 6)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_vw5b5"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_xq8mc"]
resource_local_to_scene = true resource_local_to_scene = true
shader = ExtResource("28_b3suq") shader = ExtResource("28_b3suq")
shader_parameter/color = Vector4(1, 1, 1, 1) shader_parameter/color = Vector4(1, 1, 1, 1)
shader_parameter/intensity = 0.0 shader_parameter/intensity = 0.0
shader_parameter/alpha_modulate = 1.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 resource_local_to_scene = true
shader = ExtResource("28_b3suq") shader = ExtResource("28_b3suq")
shader_parameter/color = Vector4(1, 1, 1, 1) shader_parameter/color = Vector4(1, 1, 1, 1)
shader_parameter/intensity = 0.0 shader_parameter/intensity = 0.0
shader_parameter/alpha_modulate = 1.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 resource_local_to_scene = true
shader = ExtResource("28_b3suq") shader = ExtResource("28_b3suq")
shader_parameter/color = Vector4(1, 1, 1, 1) shader_parameter/color = Vector4(1, 1, 1, 1)
shader_parameter/intensity = 0.0 shader_parameter/intensity = 0.0
shader_parameter/alpha_modulate = 1.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 resource_local_to_scene = true
shader = ExtResource("28_b3suq") shader = ExtResource("28_b3suq")
shader_parameter/color = Vector4(1, 1, 1, 1) shader_parameter/color = Vector4(1, 1, 1, 1)
shader_parameter/intensity = 0.0 shader_parameter/intensity = 0.0
shader_parameter/alpha_modulate = 1.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 resource_local_to_scene = true
shader = ExtResource("28_b3suq") shader = ExtResource("28_b3suq")
shader_parameter/color = Vector4(1, 1, 1, 1) shader_parameter/color = Vector4(1, 1, 1, 1)
shader_parameter/intensity = 0.0 shader_parameter/intensity = 0.0
shader_parameter/alpha_modulate = 1.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 resource_local_to_scene = true
shader = ExtResource("28_b3suq") shader = ExtResource("28_b3suq")
shader_parameter/color = Vector4(1, 1, 1, 1) shader_parameter/color = Vector4(1, 1, 1, 1)
shader_parameter/intensity = 0.0 shader_parameter/intensity = 0.0
shader_parameter/alpha_modulate = 1.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 resource_local_to_scene = true
shader = ExtResource("28_b3suq") shader = ExtResource("28_b3suq")
shader_parameter/color = Vector4(1, 1, 1, 1) shader_parameter/color = Vector4(1, 1, 1, 1)
shader_parameter/intensity = 0.0 shader_parameter/intensity = 0.0
shader_parameter/alpha_modulate = 1.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 resource_local_to_scene = true
shader = ExtResource("28_b3suq") shader = ExtResource("28_b3suq")
shader_parameter/color = Vector4(1, 1, 1, 1) shader_parameter/color = Vector4(1, 1, 1, 1)
shader_parameter/intensity = 0.0 shader_parameter/intensity = 0.0
shader_parameter/alpha_modulate = 1.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 resource_local_to_scene = true
shader = ExtResource("28_b3suq") shader = ExtResource("28_b3suq")
shader_parameter/color = Vector4(1, 1, 1, 1) shader_parameter/color = Vector4(1, 1, 1, 1)
shader_parameter/intensity = 0.0 shader_parameter/intensity = 0.0
shader_parameter/alpha_modulate = 1.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 resource_local_to_scene = true
shader = ExtResource("28_b3suq") shader = ExtResource("28_b3suq")
shader_parameter/color = Vector4(1, 1, 1, 1) 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) CameraLowerBound = Vector2(0, 0)
CameraUpperBound = Vector2(0, 0) CameraUpperBound = Vector2(0, 0)
ClearColor = Color(0.105882, 0.0470588, 0.117647, 1) ClearColor = Color(0.105882, 0.0470588, 0.117647, 1)
AreaName = "Depths of the Arena" AreaName = "The Arena"
MapName = "The Arena" MapName = "Depths of the Arena"
[node name="CanvasModulate" parent="." index="0"] [node name="CanvasModulate" parent="." index="0"]
color = Color(0.5, 0.5, 0.5, 1) color = Color(0.5, 0.5, 0.5, 1)
@ -677,45 +685,49 @@ position = Vector2(256, -9)
position = Vector2(80, 373) position = Vector2(80, 373)
[node name="Centurion" parent="Entities" index="7" instance=ExtResource("30_qfl2k")] [node name="Centurion" parent="Entities" index="7" instance=ExtResource("30_qfl2k")]
material = SubResource("ShaderMaterial_vw5b5") material = SubResource("ShaderMaterial_xq8mc")
position = Vector2(-360, 31) position = Vector2(-360, 31)
[node name="Centurion2" parent="Entities" index="8" instance=ExtResource("30_qfl2k")] [node name="Centurion2" parent="Entities" index="8" instance=ExtResource("30_qfl2k")]
material = SubResource("ShaderMaterial_8p2xl") material = SubResource("ShaderMaterial_w21tu")
position = Vector2(-224, 131) position = Vector2(-224, 131)
[node name="Legionary" parent="Entities" index="9" instance=ExtResource("27_84gw4")] [node name="Legionary" parent="Entities" index="9" instance=ExtResource("27_84gw4")]
material = SubResource("ShaderMaterial_ndk4b") material = SubResource("ShaderMaterial_bgnx0")
position = Vector2(-214, 72) position = Vector2(-214, 72)
[node name="Legionary2" parent="Entities" index="10" instance=ExtResource("27_84gw4")] [node name="Legionary2" parent="Entities" index="10" instance=ExtResource("27_84gw4")]
material = SubResource("ShaderMaterial_yll4k") material = SubResource("ShaderMaterial_wpwa5")
position = Vector2(-496, 15) position = Vector2(-496, 15)
[node name="Legionary3" parent="Entities" index="11" instance=ExtResource("27_84gw4")] [node name="Legionary3" parent="Entities" index="11" instance=ExtResource("27_84gw4")]
material = SubResource("ShaderMaterial_yuyxc") material = SubResource("ShaderMaterial_nayll")
position = Vector2(-240, 152) position = Vector2(-240, 152)
[node name="Legionary4" parent="Entities" index="12" instance=ExtResource("27_84gw4")] [node name="Legionary4" parent="Entities" index="12" instance=ExtResource("27_84gw4")]
material = SubResource("ShaderMaterial_ecd57") material = SubResource("ShaderMaterial_ng6wy")
position = Vector2(-300, 384) position = Vector2(-300, 384)
[node name="Legionary5" parent="Entities" index="13" instance=ExtResource("27_84gw4")] [node name="Legionary5" parent="Entities" index="13" instance=ExtResource("27_84gw4")]
material = SubResource("ShaderMaterial_ewmj1") material = SubResource("ShaderMaterial_vxxuo")
position = Vector2(-300, 401) position = Vector2(-300, 401)
[node name="Legionary6" parent="Entities" index="14" instance=ExtResource("27_84gw4")] [node name="Legionary6" parent="Entities" index="14" instance=ExtResource("27_84gw4")]
material = SubResource("ShaderMaterial_k255s") material = SubResource("ShaderMaterial_xq55r")
position = Vector2(-316, 425) position = Vector2(-316, 425)
[node name="Legionary7" parent="Entities" index="15" instance=ExtResource("27_84gw4")] [node name="Legionary7" parent="Entities" index="15" instance=ExtResource("27_84gw4")]
material = SubResource("ShaderMaterial_4sns8") material = SubResource("ShaderMaterial_1c5jm")
position = Vector2(-300, 449) position = Vector2(-300, 449)
[node name="Legionary8" parent="Entities" index="16" instance=ExtResource("27_84gw4")] [node name="Legionary8" parent="Entities" index="16" instance=ExtResource("27_84gw4")]
material = SubResource("ShaderMaterial_w1raa") material = SubResource("ShaderMaterial_r6iyg")
position = Vector2(-404, 505) 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"]
[editable path="Props/StaticBookshelf/InteractionTrigger"] [editable path="Props/StaticBookshelf/InteractionTrigger"]
[editable path="Props/StaticBookshelf2"] [editable path="Props/StaticBookshelf2"]

View File

@ -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;
}
}

View File

@ -40,6 +40,9 @@ public partial class AttackState : ThinkerState
[Export] [Export]
public ThinkerState PursueState { get; set; } public ThinkerState PursueState { get; set; }
[Export]
public bool PursueOnLineOfSight { get; set; } = true;
protected Characters.Character _bestTarget; protected Characters.Character _bestTarget;
protected float _preferredWeightDistance = 64.0f; protected float _preferredWeightDistance = 64.0f;
@ -167,7 +170,12 @@ public partial class AttackState : ThinkerState
if (PursueState is not null) if (PursueState is not null)
{ {
// pursue the player if they can not be seen or is too far away // 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; return PursueState;
} }

75
UI/Base.tscn 100644
View File

@ -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")]

View File

@ -1,4 +1,5 @@
using Godot; using Godot;
using SupaLidlGame.Extensions;
namespace SupaLidlGame.UI; namespace SupaLidlGame.UI;
@ -9,5 +10,9 @@ public partial class HealthBar : Control
public override void _Ready() public override void _Ready()
{ {
ProgressBar = GetNode<TextureProgressBar>("TextureProgressBar"); ProgressBar = GetNode<TextureProgressBar>("TextureProgressBar");
this.GetEventBus().PlayerHealthChanged += (args) =>
{
ProgressBar.Value = args.NewHealth;
};
} }
} }

View File

@ -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<Label>("%MapName");
_subtitle = GetNode<Label>("%Subtitle");
_animPlayer = GetNode<AnimationPlayer>("%AnimationPlayer");
var bus = this.GetEventBus();
bus.AreaChanged += OnAreaChanged;
}
public void OnAreaChanged(Scenes.Map map)
{
//var map = args.Map;
// if the area name is the same as the map name, do not show a subtitle
_subtitle.Visible = map.AreaName != map.MapName;
_mapName.Text = map.MapName;
_subtitle.Text = map.AreaName;
_animPlayer.Play("show");
}
}

View File

@ -0,0 +1,221 @@
[gd_scene load_steps=12 format=3 uid="uid://c77754nvmckn"]
[ext_resource type="Texture2D" uid="uid://cd8ak8gu0104t" path="res://Assets/Sprites/UI/border.png" id="1_bjspn"]
[ext_resource type="Script" path="res://UI/LocationDisplay.cs" id="1_g1mdf"]
[ext_resource type="Shader" path="res://Shaders/Wipe.gdshader" id="2_5k5hi"]
[ext_resource type="Texture2D" uid="uid://t467i5xou4ug" path="res://Assets/Sprites/UI/menu-center.png" id="2_by7yu"]
[ext_resource type="Theme" uid="uid://cksjbu3vrup5" path="res://UI/Themes/supalidl.tres" id="2_oifrp"]
[ext_resource type="FontFile" uid="uid://6bvgjbmqovau" path="res://Assets/Fonts/calamity/calamity.ttf" id="4_blqpy"]
[ext_resource type="FontFile" uid="uid://cgwa8bjiyv534" path="res://Assets/Fonts/alagard.ttf" id="4_gutht"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_4mc54"]
shader = ExtResource("2_5k5hi")
shader_parameter/amount = 0.5
[sub_resource type="Animation" id="Animation_acam2"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("NinePatchRect:material:shader_parameter/amount")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.5]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("VBoxContainer:modulate")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 1)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("VBoxContainer/MapName:visible_ratio")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("%Subtitle:visible_ratio")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("..:modulate")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 1)]
}
[sub_resource type="Animation" id="Animation_3cm2m"]
resource_name = "show"
length = 8.0
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("NinePatchRect:material:shader_parameter/amount")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(2, 3),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [0.5, 1.0]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("VBoxContainer:modulate")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(2, 3, 4),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("VBoxContainer/MapName:visible_ratio")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(2, 3, 4),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [0.0, 0.0, 1.0]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("%Subtitle:visible_ratio")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(2, 4.5, 5.5),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [0.0, 0.0, 1.0]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("..:modulate")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(2, 6, 8),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_qq8ub"]
_data = {
"RESET": SubResource("Animation_acam2"),
"show": SubResource("Animation_3cm2m")
}
[node name="LocationDisplay" type="CenterContainer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_g1mdf")
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/separation = 0
[node name="NinePatchRect" type="NinePatchRect" parent="VBoxContainer"]
material = SubResource("ShaderMaterial_4mc54")
custom_minimum_size = Vector2(96, 0)
layout_mode = 2
texture = ExtResource("1_bjspn")
patch_margin_left = 16
patch_margin_top = 16
patch_margin_right = 16
[node name="TextureRect" type="TextureRect" parent="VBoxContainer/NinePatchRect"]
use_parent_material = true
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -32.0
offset_top = -8.0
offset_right = 32.0
offset_bottom = 8.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("2_by7yu")
[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer"]
layout_mode = 2
theme_override_constants/separation = 0
[node name="MapName" type="Label" parent="VBoxContainer/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
theme = ExtResource("2_oifrp")
theme_override_constants/line_spacing = 0
theme_override_fonts/font = ExtResource("4_blqpy")
theme_override_font_sizes/font_size = 15
text = "Depths of the Arena"
horizontal_alignment = 1
vertical_alignment = 1
visible_characters = 0
visible_ratio = 0.0
[node name="Subtitle" type="Label" parent="VBoxContainer/VBoxContainer"]
unique_name_in_owner = true
texture_filter = 1
layout_mode = 2
theme = ExtResource("2_oifrp")
theme_override_constants/line_spacing = -1
theme_override_fonts/font = ExtResource("4_gutht")
theme_override_font_sizes/font_size = 16
text = "The Arena"
horizontal_alignment = 1
vertical_alignment = 1
visible_characters = 0
visible_ratio = 0.0
[node name="AnimationPlayer" type="AnimationPlayer" parent="VBoxContainer"]
unique_name_in_owner = true
libraries = {
"": SubResource("AnimationLibrary_qq8ub")
}

View File

@ -19,7 +19,6 @@ public partial class World : Node
[Export] [Export]
public Boss CurrentBoss { get; set; } public Boss CurrentBoss { get; set; }
[Export]
public UI.UIController UIController { get; set; } public UI.UIController UIController { get; set; }
[Export] [Export]
@ -30,11 +29,10 @@ public partial class World : Node
{ {
get get
{ {
if (_dialogueBalloon is null || !IsInstanceValid(_dialogueBalloon)) if (!IsDialogueOpen)
{ {
var scene = GD.Load<PackedScene>("res://Dialogue/balloon.tscn"); var scene = GD.Load<PackedScene>("res://Dialogue/balloon.tscn");
_dialogueBalloon = scene.Instantiate<Dialogue.Balloon>(); _dialogueBalloon = scene.Instantiate<Dialogue.Balloon>();
//_uiViewport.AddChild(_dialogueBalloon);
_uiViewport.AddChild(_dialogueBalloon); _uiViewport.AddChild(_dialogueBalloon);
} }
return _dialogueBalloon; return _dialogueBalloon;
@ -49,6 +47,11 @@ public partial class World : Node
} }
} }
public bool IsDialogueOpen
{
get => _dialogueBalloon is not null && IsInstanceValid(_dialogueBalloon);
}
private Dialogue.Balloon _dialogueBalloon; private Dialogue.Balloon _dialogueBalloon;
private SubViewport _uiViewport; private SubViewport _uiViewport;
@ -89,6 +92,14 @@ public partial class World : Node
Godot.RenderingServer.SetDefaultClearColor(Godot.Colors.Black); Godot.RenderingServer.SetDefaultClearColor(Godot.Colors.Black);
UIController = this.GetMainUI();
EventBus = this.GetEventBus();
EventBus.RequestMoveToArea += (Events.RequestAreaArgs args) =>
{
MoveToArea(args.Area, args.Connector);
};
_uiViewport = GetNode<SubViewport>("CanvasLayer/SubViewportContainer/UIViewport"); _uiViewport = GetNode<SubViewport>("CanvasLayer/SubViewportContainer/UIViewport");
// create a player (currently unparented) // create a player (currently unparented)
@ -97,12 +108,6 @@ public partial class World : Node
// TODO: create start menu and load game from there // TODO: create start menu and load game from there
LoadGame(); LoadGame();
EventBus = this.GetEventBus();
EventBus.RequestMoveToArea += (Events.RequestAreaArgs args) =>
{
MoveToArea(args.Area, args.Connector);
};
base._Ready(); base._Ready();
} }
@ -147,6 +152,8 @@ public partial class World : Node
CurrentMap.Active = true; CurrentMap.Active = true;
CurrentMap.Load(); CurrentMap.Load();
EventBus.EmitSignal(Events.EventBus.SignalName.AreaChanged, map);
if (CurrentPlayer is not null) if (CurrentPlayer is not null)
{ {
CurrentMap.Entities.AddChild(CurrentPlayer); CurrentMap.Entities.AddChild(CurrentPlayer);
@ -224,12 +231,14 @@ public partial class World : Node
}; };
}; };
/*
CurrentPlayer.Hurt += (Events.HurtArgs args) => CurrentPlayer.Hurt += (Events.HurtArgs args) =>
{ {
// TODO: move this to UI controller and add a setup method // TODO: move this to UI controller and add a setup method
var bar = UIController.GetNode<UI.HealthBar>("Top/Margin/HealthBar"); var bar = UIController.GetNode<UI.HealthBar>("Top/Margin/HealthBar");
bar.ProgressBar.Value = args.NewHealth; bar.ProgressBar.Value = args.NewHealth;
}; };
*/
return CurrentPlayer; return CurrentPlayer;
} }

View File

@ -20,6 +20,7 @@ config/icon="res://icon.svg"
DialogueManager="*res://addons/dialogue_manager/dialogue_manager.gd" DialogueManager="*res://addons/dialogue_manager/dialogue_manager.gd"
GlobalState="*res://State/Global/GlobalState.cs" GlobalState="*res://State/Global/GlobalState.cs"
EventBus="*res://Events/EventBus.cs" EventBus="*res://Events/EventBus.cs"
BaseUI="*res://UI/Base.tscn"
World="*res://Scenes/Level.tscn" World="*res://Scenes/Level.tscn"
DebugConsole="*res://Debug/DebugConsole.cs" DebugConsole="*res://Debug/DebugConsole.cs"
Panku="*res://addons/panku_console/console.tscn" Panku="*res://addons/panku_console/console.tscn"
@ -50,6 +51,7 @@ ui_accept={
"deadzone": 0.5, "deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194309,"physical_keycode":0,"key_label":0,"unicode":4194309,"echo":false,"script":null) "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194309,"physical_keycode":0,"key_label":0,"unicode":4194309,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194310,"physical_keycode":0,"key_label":0,"unicode":4194310,"echo":false,"script":null) , Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194310,"physical_keycode":0,"key_label":0,"unicode":4194310,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
] ]
} }
ui_left={ ui_left={
@ -80,16 +82,19 @@ roll={
"deadzone": 0.5, "deadzone": 0.5,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":3,"pressed":false,"double_click":false,"script":null) "events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":3,"pressed":false,"double_click":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":0,"echo":false,"script":null) , Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":7,"pressure":0.0,"pressed":false,"script":null)
] ]
} }
attack1={ attack1={
"deadzone": 0.5, "deadzone": 0.5,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"pressed":false,"double_click":false,"script":null) "events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"pressed":false,"double_click":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":5,"axis_value":1.0,"script":null)
] ]
} }
attack2={ attack2={
"deadzone": 0.5, "deadzone": 0.5,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":2,"pressed":false,"double_click":false,"script":null) "events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":2,"pressed":false,"double_click":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":1.0,"script":null)
] ]
} }
equip={ equip={
@ -100,6 +105,7 @@ equip={
interact={ interact={
"deadzone": 0.5, "deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":70,"key_label":0,"unicode":0,"echo":false,"script":null) "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":70,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":2,"pressure":0.0,"pressed":false,"script":null)
] ]
} }
equip_1={ equip_1={
@ -146,6 +152,26 @@ right={
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null) , Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null)
] ]
} }
look_up={
"deadzone": 0.5,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":4,"axis_value":-1.0,"script":null)
]
}
look_down={
"deadzone": 0.5,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":4,"axis_value":1.0,"script":null)
]
}
look_left={
"deadzone": 0.5,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":-1.0,"script":null)
]
}
look_right={
"deadzone": 0.5,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":1.0,"script":null)
]
}
[internationalization] [internationalization]