From 0d812232081174c1b7a3e50c03c847eab117cdfa Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 19 Sep 2019 18:50:47 +0300 Subject: Fixed screen printing and tweaked some things Rather than writing and then clearing the screen, now cursor psition is moved to the beginning and writes over old screen. Mobs now heal only after they have regained all their "Air". Made map sizes bigger. Creatures get affected by biomes more slowly. --- Bitspace 2.0/Bitspace 2.0/Game creatures/Mob.cs | 10 +++++++--- Bitspace 2.0/Bitspace 2.0/Graphics.cs | 3 ++- Bitspace 2.0/Bitspace 2.0/Menu.cs | 13 +++++++------ 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Bitspace 2.0/Bitspace 2.0/Game creatures/Mob.cs b/Bitspace 2.0/Bitspace 2.0/Game creatures/Mob.cs index 497c418..094e308 100644 --- a/Bitspace 2.0/Bitspace 2.0/Game creatures/Mob.cs +++ b/Bitspace 2.0/Bitspace 2.0/Game creatures/Mob.cs @@ -57,7 +57,7 @@ namespace Bitspace_2._0.Game_creatures { } public void GetAffectedByBiome(Biome currBiome) { - this.Heal(currBiome.HealPoints); + if (HasFullLungs()) this.Heal(currBiome.HealPoints); if (currBiome.Suffocate) this.Suffocate(); else this.TakeBreather(); @@ -73,11 +73,15 @@ namespace Bitspace_2._0.Game_creatures { } public void TakeBreather() { - if (IsAlive() && LungCapacity < MaxLungCapacity) { + if (IsAlive() && !HasFullLungs()) { LungCapacity++; } } + private bool HasFullLungs() { + return LungCapacity == MaxLungCapacity; + } + public void Suffocate() { if (this.LungCapacity > 0) { this.LungCapacity--; @@ -145,7 +149,7 @@ namespace Bitspace_2._0.Game_creatures { var toReturn = new StringBuilder(new string('O', this.LungCapacity)); for (int i = this.LungCapacity; i < this.MaxLungCapacity; i++) { - toReturn.Append(' '); + toReturn.Append('*'); } return toReturn.ToString(); } diff --git a/Bitspace 2.0/Bitspace 2.0/Graphics.cs b/Bitspace 2.0/Bitspace 2.0/Graphics.cs index fdf52bd..5837631 100644 --- a/Bitspace 2.0/Bitspace 2.0/Graphics.cs +++ b/Bitspace 2.0/Bitspace 2.0/Graphics.cs @@ -11,7 +11,8 @@ namespace Bitspace_2._0 { public static bool Mono = false; public static void ReWriteScreen() { - Console.Clear(); + Console.SetCursorPosition(0, 0); + Console.CursorVisible = false; UpdateLayers(); diff --git a/Bitspace 2.0/Bitspace 2.0/Menu.cs b/Bitspace 2.0/Bitspace 2.0/Menu.cs index b65ef98..e306803 100644 --- a/Bitspace 2.0/Bitspace 2.0/Menu.cs +++ b/Bitspace 2.0/Bitspace 2.0/Menu.cs @@ -13,6 +13,7 @@ namespace Bitspace_2._0 { yPos = 2; while (true) { Console.Clear(); + Console.CursorVisible = false; Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine("Bitspace"); @@ -37,16 +38,16 @@ namespace Bitspace_2._0 { Console.ForegroundColor = ConsoleColor.Gray; Console.WriteLine("Choose map size:"); Console.WriteLine(); - Console.WriteLine(" Small (5 x 10)"); - Console.WriteLine(" Medium (10 x 20)"); - Console.WriteLine(" Large (20 x 40)"); + Console.WriteLine(" Small (30 x 10)"); + Console.WriteLine(" Medium (60 x 30)"); + Console.WriteLine(" Large (100 x 40)"); if (!MenuCursor(2, 4)) break; } switch (yPos) { - case 2: Map.Generate(5, 10); break; - case 3: Map.Generate(10, 20); break; - case 4: Map.Generate(20, 40); break; + case 2: Map.Generate(30, 10); break; + case 3: Map.Generate(60, 30); break; + case 4: Map.Generate(100, 40); break; } } -- cgit v1.2.3