Make adjustments to bad end map

Modify debug menu slightly to pause while open (need to close the menu to load floors, etc)
Clear map when game over screen appears
This commit is contained in:
2026-06-08 00:08:25 -07:00
parent 19bf9563b6
commit 2ab6158849
12 changed files with 208 additions and 78 deletions
@@ -30,10 +30,14 @@ public interface IPlayer : IKillable, ICharacterBody3D
public void SetSigil(ISigil sigil); public void SetSigil(ISigil sigil);
public void ShowCamera(bool showCamera);
public void ApplyNewAugment(IAugmentItem jewel, IAugmentableItem equipableItem); public void ApplyNewAugment(IAugmentItem jewel, IAugmentableItem equipableItem);
public IBaseInventoryItem IdentifyItem(IBaseInventoryItem unidentifiedItem); public IBaseInventoryItem IdentifyItem(IBaseInventoryItem unidentifiedItem);
public void ShakePlayerCamera(float shakeIntensity, float shakeAmount);
public IInventory Inventory { get; } public IInventory Inventory { get; }
public IHealthComponent HealthComponent { get; } public IHealthComponent HealthComponent { get; }
+8 -1
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=29 format=3 uid="uid://brgi35xj3b4ud"] [gd_scene load_steps=30 format=3 uid="uid://brgi35xj3b4ud"]
[ext_resource type="Script" uid="uid://cw100tox0ufsy" path="res://src/audio/SfxDatabase.cs" id="1_ojkqd"] [ext_resource type="Script" uid="uid://cw100tox0ufsy" path="res://src/audio/SfxDatabase.cs" id="1_ojkqd"]
[ext_resource type="AudioStream" uid="uid://cye8wlqbx66h4" path="res://src/audio/sfx/player_heal.ogg" id="2_158j8"] [ext_resource type="AudioStream" uid="uid://cye8wlqbx66h4" path="res://src/audio/sfx/player_heal.ogg" id="2_158j8"]
@@ -22,6 +22,7 @@
[ext_resource type="AudioStream" uid="uid://brb8xj4vsgcw4" path="res://src/audio/sfx/player_DEBUFF.ogg" id="18_bi4v5"] [ext_resource type="AudioStream" uid="uid://brb8xj4vsgcw4" path="res://src/audio/sfx/player_DEBUFF.ogg" id="18_bi4v5"]
[ext_resource type="AudioStream" uid="uid://coeynqnn61c43" path="res://src/audio/sfx/environment_ITEM_TRANSFER.ogg" id="18_l6w22"] [ext_resource type="AudioStream" uid="uid://coeynqnn61c43" path="res://src/audio/sfx/environment_ITEM_TRANSFER.ogg" id="18_l6w22"]
[ext_resource type="AudioStream" uid="uid://bfrmm07vthpwt" path="res://src/audio/sfx/item_divine_recall.ogg" id="19_nerso"] [ext_resource type="AudioStream" uid="uid://bfrmm07vthpwt" path="res://src/audio/sfx/item_divine_recall.ogg" id="19_nerso"]
[ext_resource type="AudioStream" uid="uid://dl6svxp5ow2vk" path="res://src/audio/sfx/player_death_1.ogg" id="19_uv31i"]
[ext_resource type="AudioStream" uid="uid://bu8akh5uh3ioo" path="res://src/audio/sfx/item_devic_balance_element1.ogg" id="20_rloay"] [ext_resource type="AudioStream" uid="uid://bu8akh5uh3ioo" path="res://src/audio/sfx/item_devic_balance_element1.ogg" id="20_rloay"]
[ext_resource type="AudioStream" uid="uid://bjkn6s2xjxuji" path="res://src/audio/sfx/item_gospel_dimension.ogg" id="21_6hsck"] [ext_resource type="AudioStream" uid="uid://bjkn6s2xjxuji" path="res://src/audio/sfx/item_gospel_dimension.ogg" id="21_6hsck"]
[ext_resource type="AudioStream" uid="uid://c3ur4bgvmsidi" path="res://src/audio/sfx/item_gospel_escape.ogg" id="22_3wq6u"] [ext_resource type="AudioStream" uid="uid://c3ur4bgvmsidi" path="res://src/audio/sfx/item_gospel_escape.ogg" id="22_3wq6u"]
@@ -139,6 +140,12 @@ process_mode = 3
stream = ExtResource("18_bi4v5") stream = ExtResource("18_bi4v5")
bus = &"SFX" bus = &"SFX"
[node name="DeathSound" type="AudioStreamPlayer" parent="Player"]
unique_name_in_owner = true
process_mode = 3
stream = ExtResource("19_uv31i")
bus = &"SFX"
[node name="Item" type="Node" parent="."] [node name="Item" type="Node" parent="."]
[node name="TransferItemSound" type="AudioStreamPlayer" parent="Item"] [node name="TransferItemSound" type="AudioStreamPlayer" parent="Item"]
+4 -1
View File
@@ -33,6 +33,7 @@ public partial class SfxDatabase : Node
{SoundEffect.Unequip, UnequipSound }, {SoundEffect.Unequip, UnequipSound },
{SoundEffect.Buff, BuffSound }, {SoundEffect.Buff, BuffSound },
{SoundEffect.Debuff, DebuffSound }, {SoundEffect.Debuff, DebuffSound },
{SoundEffect.Death, DeathSound },
{SoundEffect.SortInventory, SortSound }, {SoundEffect.SortInventory, SortSound },
{SoundEffect.SelectUI, SelectSound }, {SoundEffect.SelectUI, SelectSound },
{SoundEffect.CancelUI, CancelSound }, {SoundEffect.CancelUI, CancelSound },
@@ -67,6 +68,7 @@ public partial class SfxDatabase : Node
[Node] private AudioStreamPlayer UnequipSound { get; set; } [Node] private AudioStreamPlayer UnequipSound { get; set; }
[Node] private AudioStreamPlayer BuffSound { get; set; } [Node] private AudioStreamPlayer BuffSound { get; set; }
[Node] private AudioStreamPlayer DebuffSound { get; set; } [Node] private AudioStreamPlayer DebuffSound { get; set; }
[Node] private AudioStreamPlayer DeathSound { get; set; }
[Node] private AudioStreamPlayer SortSound { get; set; } [Node] private AudioStreamPlayer SortSound { get; set; }
[Node] private AudioStreamPlayer SelectSound { get; set; } [Node] private AudioStreamPlayer SelectSound { get; set; }
[Node] private AudioStreamPlayer CancelSound { get; set; } [Node] private AudioStreamPlayer CancelSound { get; set; }
@@ -120,6 +122,7 @@ public enum SoundEffect
WeaponPlasmaSword, WeaponPlasmaSword,
Eucharistia, Eucharistia,
Buff, Buff,
Debuff Debuff,
Death
} }
+1 -1
View File
@@ -8,7 +8,7 @@ public partial class ShakeCamera : Camera3D
{ {
public override void _Notification(int what) => this.Notify(what); public override void _Notification(int what) => this.Notify(what);
[Export] private double _shakeIntensity = 1.0; [Export] public double _shakeIntensity { get; set; } = 1.0;
[Export] private double _maxX = 10; [Export] private double _maxX = 10;
[Export] private double _maxY = 10; [Export] private double _maxY = 10;
+6 -7
View File
@@ -215,6 +215,7 @@ public partial class Game : Node3D, IGame
_player.PlayerDied += GameOver; _player.PlayerDied += GameOver;
GameOverMenu.NewGame += OnNewGame; GameOverMenu.NewGame += OnNewGame;
GameOverMenu.QuitGame += OnQuit; GameOverMenu.QuitGame += OnQuit;
GameOverMenu.GameOverMenuVisible += GameOverMenuAppeared;
PauseMenu.ExitGamePressed += OnQuit; PauseMenu.ExitGamePressed += OnQuit;
PauseMenu.UnpauseButtonPressed += OnResume; PauseMenu.UnpauseButtonPressed += OnResume;
@@ -339,6 +340,7 @@ public partial class Game : Node3D, IGame
{ {
QuestData.DeathCount++; QuestData.DeathCount++;
await Save(); await Save();
_player.SetSigil(new NoneSigil());
_player.Deactivate(); _player.Deactivate();
GameRepo.Pause(); GameRepo.Pause();
GameState.Input(new GameState.Input.GameOver()); GameState.Input(new GameState.Input.GameOver());
@@ -393,15 +395,13 @@ public partial class Game : Node3D, IGame
}) })
.Handle((in GameState.Output.OpenDebugMenu _) => .Handle((in GameState.Output.OpenDebugMenu _) =>
{ {
GameRepo.Pause();
InGameUI.DebugMenu.Show(); InGameUI.DebugMenu.Show();
InGameUI.PlayerInfoUI.Hide();
_player.Deactivate();
}) })
.Handle((in GameState.Output.CloseDebugMenu _) => .Handle((in GameState.Output.CloseDebugMenu _) =>
{ {
GameRepo.Resume();
InGameUI.DebugMenu.Hide(); InGameUI.DebugMenu.Hide();
InGameUI.PlayerInfoUI.Show();
_player.Activate();
}) })
.Handle((in GameState.Output.OpenTeleportScreen _) => .Handle((in GameState.Output.OpenTeleportScreen _) =>
{ {
@@ -451,9 +451,6 @@ public partial class Game : Node3D, IGame
.Handle((in GameState.Output.GameOver _) => .Handle((in GameState.Output.GameOver _) =>
{ {
GameOverMenu.FadeIn(); GameOverMenu.FadeIn();
var enemies = GetTree().GetNodesInGroup("enemy").OfType<IEnemy>();
foreach (var enemy in enemies)
enemy.CallDeferred(MethodName.QueueFree, []);
}); });
} }
@@ -961,6 +958,8 @@ public partial class Game : Node3D, IGame
private void OnQuit() => GameExitRequested?.Invoke(); private void OnQuit() => GameExitRequested?.Invoke();
private void GameOverMenuAppeared() => _map.ClearFloor();
private void OnResume() => GameState.Input(new GameState.Input.PauseButtonPressed()); private void OnResume() => GameState.Input(new GameState.Input.PauseButtonPressed());
public void OnExitTree() public void OnExitTree()
+8
View File
@@ -88,8 +88,16 @@ public partial class Map : Node3D, IMap
public void ClearFloor() public void ClearFloor()
{ {
try
{
if (CurrentFloor != null && !CurrentFloor.IsQueuedForDeletion())
CurrentFloor?.CallDeferred(MethodName.QueueFree, []); CurrentFloor?.CallDeferred(MethodName.QueueFree, []);
} }
catch (ObjectDisposedException ex)
{
}
}
public async Task LoadFloor() public async Task LoadFloor()
{ {
File diff suppressed because one or more lines are too long
@@ -3,19 +3,47 @@ using Chickensoft.Introspection;
using Godot; using Godot;
using System.Linq; using System.Linq;
using Zennysoft.Game.Ma; using Zennysoft.Game.Ma;
using Zennysoft.Ma.Adapter;
[Meta(typeof(IAutoNode))] [Meta(typeof(IAutoNode))]
public partial class BadEnd : SpecialFloor public partial class BadEnd : SpecialFloor
{ {
public override void _Notification(int what) => this.Notify(what); public override void _Notification(int what) => this.Notify(what);
[Dependency] protected IPlayer _player => this.DependOn(() => GetParent().GetChildren().OfType<IPlayer>().Single());
[Dependency] protected IGame _game => this.DependOn<IGame>();
[Export] public float ShakeAmount = 50;
[Node] public Node3D EnemySpawnPoints { get; set; } = default!; [Node] public Node3D EnemySpawnPoints { get; set; } = default!;
[Node] public Marker3D PlayerSpawnPoint { get; set; } = default!; [Node] public Marker3D PlayerSpawnPoint { get; set; } = default!;
[Node] public ShakeCamera Camera3D { get; set; } = default!;
public void OnReady() public void OnReady()
{ {
SpawnEnemies(); SpawnEnemies();
var tweener = GetTree().CreateTween();
tweener.TweenMethod(Callable.From((float x) => SetShakeValue(x)), ShakeAmount, 1f, 700f).SetDelay(30);
}
public void StartEndGameCutscene()
{
_player.Deactivate();
_player.ShowCamera(false);
Camera3D.Current = true;
}
public void EndGame()
{
SfxDatabase.Instance.Play(SoundEffect.Death);
_game.GameOver();
}
private void SetShakeValue(float shakeAmount)
{
_player.ShakePlayerCamera(shakeAmount, 1f);
} }
public void SpawnEnemies() public void SpawnEnemies()
@@ -49,4 +49,6 @@ public partial class DummyPlayer : CharacterBody3D, IPlayer
public IBaseInventoryItem IdentifyItem(IBaseInventoryItem unidentifiedItem) => throw new NotImplementedException(); public IBaseInventoryItem IdentifyItem(IBaseInventoryItem unidentifiedItem) => throw new NotImplementedException();
public void EnactBriefImmunity() => throw new NotImplementedException(); public void EnactBriefImmunity() => throw new NotImplementedException();
public void SetSigil(ISigil sigil) => throw new NotImplementedException(); public void SetSigil(ISigil sigil) => throw new NotImplementedException();
public void ShakePlayerCamera(float shakeIntensity, float shakeAmount) => throw new NotImplementedException();
public void ShowCamera(bool showCamera) => throw new NotImplementedException();
} }
+12 -8
View File
@@ -205,8 +205,6 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
LuckComponent.Reset(); LuckComponent.Reset();
EquipmentComponent.Reset(); EquipmentComponent.Reset();
SigilComponent.Reset(); SigilComponent.Reset();
HealthTimer.Timeout += OnHealthTimerTimeout;
} }
#region Initialization #region Initialization
@@ -220,6 +218,7 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
ExperiencePointsComponent.PlayerLevelDown += OnLevelDown; ExperiencePointsComponent.PlayerLevelDown += OnLevelDown;
PlayerFXAnimations.AnimationFinished += PlayerFXAnimations_AnimationFinished; PlayerFXAnimations.AnimationFinished += PlayerFXAnimations_AnimationFinished;
HealthTimer.WaitTime = _healthTimerWaitTime; HealthTimer.WaitTime = _healthTimerWaitTime;
HealthTimer.Timeout += OnHealthTimerTimeout;
_projectileCooldownTimer = new Timer(); _projectileCooldownTimer = new Timer();
AddChild(_projectileCooldownTimer); AddChild(_projectileCooldownTimer);
@@ -248,6 +247,7 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
SetProcessInput(true); SetProcessInput(true);
SetPhysicsProcess(true); SetPhysicsProcess(true);
SetHealthTimerStatus(HealthTimerIsActive); SetHealthTimerStatus(HealthTimerIsActive);
ShowCamera(true);
Hitbox.SetDeferred(Area3D.PropertyName.Monitoring, true); Hitbox.SetDeferred(Area3D.PropertyName.Monitoring, true);
Hitbox.SetDeferred(Area3D.PropertyName.Monitorable, true); Hitbox.SetDeferred(Area3D.PropertyName.Monitorable, true);
} }
@@ -290,12 +290,14 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
ResetPhysicsInterpolation(); ResetPhysicsInterpolation();
} }
public void ShowCamera(bool showCamera) => _camera3D.Current = showCamera;
public void TakeDamage(AttackData damage) public void TakeDamage(AttackData damage)
{ {
if (BriefImmunity) if (BriefImmunity)
return; return;
_camera3D.AddShake(1.0f); ShakePlayerCamera(1, 1);
TakeDamageAnimationPlayer.Play("take_damage"); TakeDamageAnimationPlayer.Play("take_damage");
var defense = TotalDefense; var defense = TotalDefense;
var elementalResistance = EquipmentComponent.ElementalResistance + SigilComponent.Sigil.ElementalResistanceSet; var elementalResistance = EquipmentComponent.ElementalResistance + SigilComponent.Sigil.ElementalResistanceSet;
@@ -329,6 +331,12 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
public IBaseInventoryItem IdentifyItem(IBaseInventoryItem unidentifiedItem) => _itemReroller.RerollItem(unidentifiedItem, Inventory); public IBaseInventoryItem IdentifyItem(IBaseInventoryItem unidentifiedItem) => _itemReroller.RerollItem(unidentifiedItem, Inventory);
public void ShakePlayerCamera(float shakeIntensity, float shakeAmount)
{
_camera3D._shakeIntensity = shakeIntensity;
_camera3D.AddShake(shakeAmount);
}
public int TotalAttack => AttackComponent.CurrentAttack.Value + EquipmentComponent.BonusAttack; public int TotalAttack => AttackComponent.CurrentAttack.Value + EquipmentComponent.BonusAttack;
public int TotalDefense => DefenseComponent.CurrentDefense.Value + EquipmentComponent.BonusDefense; public int TotalDefense => DefenseComponent.CurrentDefense.Value + EquipmentComponent.BonusDefense;
@@ -348,11 +356,7 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
return; return;
SetSigil(new NoneSigil()); SetSigil(new NoneSigil());
Deactivate();
HealthTimer.WaitTime = _healthTimerWaitTime;
HealthTimer.Timeout -= OnHealthTimerTimeout;
SetProcessInput(false);
SetPhysicsProcess(false);
} }
public override void _Input(InputEvent @event) public override void _Input(InputEvent @event)
+1
View File
@@ -13031,6 +13031,7 @@ collision_mask = 775
script = ExtResource("1_xcol5") script = ExtResource("1_xcol5")
RotationSpeed = 1.6 RotationSpeed = 1.6
HealthTimerIsActive = true HealthTimerIsActive = true
_immunityTime = 99999.0
[node name="MainCollision" type="CollisionShape3D" parent="."] [node name="MainCollision" type="CollisionShape3D" parent="."]
unique_name_in_owner = true unique_name_in_owner = true
@@ -13,6 +13,7 @@ public interface IGameOverMenu : IControl
public event Action NewGame; public event Action NewGame;
public event Action QuitGame; public event Action QuitGame;
public event Action GameOverMenuVisible;
} }
[Meta(typeof(IAutoNode))] [Meta(typeof(IAutoNode))]
@@ -22,6 +23,7 @@ public partial class GameOverMenu : Control, IGameOverMenu
public event Action NewGame; public event Action NewGame;
public event Action QuitGame; public event Action QuitGame;
public event Action GameOverMenuVisible;
[Dependency] Game Game => this.DependOn<Game>(); [Dependency] Game Game => this.DependOn<Game>();
@@ -36,6 +38,13 @@ public partial class GameOverMenu : Control, IGameOverMenu
Continue.Pressed += Continue_Pressed; Continue.Pressed += Continue_Pressed;
Exit.Pressed += Exit_Pressed; Exit.Pressed += Exit_Pressed;
VisibilityChanged += DeathMenu_VisibilityChanged; VisibilityChanged += DeathMenu_VisibilityChanged;
AnimationPlayer.AnimationFinished += AnimationPlayer_AnimationFinished;
}
private void AnimationPlayer_AnimationFinished(StringName animName)
{
if (animName == "fade_in")
GameOverMenuVisible?.Invoke();
} }
private void DeathMenu_VisibilityChanged() private void DeathMenu_VisibilityChanged()