From d9f1e4c8b38b61689a428d19e06aaa57867ab798 Mon Sep 17 00:00:00 2001 From: djkato Date: Tue, 7 Jul 2020 00:56:25 +0200 Subject: [PATCH] V1 First upload/change --- Build/Ceed.exe | Bin 0 -> 27624 bytes Code/App.config | 6 + Code/Ceed.csproj | 108 +++++++ Code/Ceed.csproj.user | 17 ++ Code/Ceed.sln | 25 ++ Code/CeedMain/Main.cs | 259 ++++++++++++++++ Code/CeedMain/PirateShip.cs | 13 + Code/CeedMain/Planet.cs | 93 ++++++ Code/CeedMain/PlayerShip.cs | 94 ++++++ Code/CeedMain/Renderer.cs | 413 ++++++++++++++++++++++++++ Code/CeedMain/ShipTemplate.cs | 15 + Code/CeedMain/SolarSystem.cs | 69 +++++ Code/Properties/AssemblyInfo.cs | 36 +++ Code/SpaceShooter/Assets.txt | 25 ++ Code/SpaceShooter/Asteroid.cs | 64 ++++ Code/SpaceShooter/DEADShip.cs | 70 +++++ Code/SpaceShooter/GameLogic.cs | 254 ++++++++++++++++ Code/SpaceShooter/Pirate.cs | 61 ++++ Code/SpaceShooter/Projectile.cs | 66 ++++ Code/SpaceShooter/Render.cs | 247 +++++++++++++++ Code/SpaceShooter/SpaceShooterMain.cs | 204 +++++++++++++ 21 files changed, 2139 insertions(+) create mode 100644 Build/Ceed.exe create mode 100644 Code/App.config create mode 100644 Code/Ceed.csproj create mode 100644 Code/Ceed.csproj.user create mode 100644 Code/Ceed.sln create mode 100644 Code/CeedMain/Main.cs create mode 100644 Code/CeedMain/PirateShip.cs create mode 100644 Code/CeedMain/Planet.cs create mode 100644 Code/CeedMain/PlayerShip.cs create mode 100644 Code/CeedMain/Renderer.cs create mode 100644 Code/CeedMain/ShipTemplate.cs create mode 100644 Code/CeedMain/SolarSystem.cs create mode 100644 Code/Properties/AssemblyInfo.cs create mode 100644 Code/SpaceShooter/Assets.txt create mode 100644 Code/SpaceShooter/Asteroid.cs create mode 100644 Code/SpaceShooter/DEADShip.cs create mode 100644 Code/SpaceShooter/GameLogic.cs create mode 100644 Code/SpaceShooter/Pirate.cs create mode 100644 Code/SpaceShooter/Projectile.cs create mode 100644 Code/SpaceShooter/Render.cs create mode 100644 Code/SpaceShooter/SpaceShooterMain.cs diff --git a/Build/Ceed.exe b/Build/Ceed.exe new file mode 100644 index 0000000000000000000000000000000000000000..8f1f8c451cfb7d21c328876388a60e7eef9b2d25 GIT binary patch literal 27624 zcmeHwd3YSvmG7S9B}$tRmjmOI*i$EQjp93nFKHLWMU{G^CNwJO^CZ5&2frmS zt}EUmLxLP3b;?o4VJE$@xM1+iBe~t?AOESzoLX_h2<_RIXY}#LPjpkKnZXe)H zj&`lN)bSkPHy=a+8jlrvJ3mn&u4py0<{*%)+Y~A^&@1qDeAdDst!8RC14h!7bS4{! z!}vNrYlT?n0J(ZO*%cqsO%)#T>1{%My@hP2iWLsCGSgpBgxWmfX+<*D)Ma7(K%-%p zz>LLo2EwMN07RTXl@q9TwyALfwGJR`nEt%9aM($SIDslBP;HhK+SE8YjTk0$v=ogv zrA3_5B2H-$r=k(3qLErhKUIbkaEh*Simq~su5ya5a*D31bqu@OY2NCvqn~Q0d8?h~ zt*&+qySm0H&0*fA-KsT*lbAEN8Vh0un_9CWT&6Ik?j{jxbBTvB-GKCPtP+Hhpc0#l zYe1{-ZVPJl(F@-JI)GNA>#bZ{-`c3vCtCZo`hBgd;@7AXDI7CaO2W5SIH9V(j(JXa zNxKuO>TjP9eF7|Lk}fI(HJ7yvpi?Xwcl=UkgZ4(%U^Mp*wk|Z6ea``N|0LDp3#T!K zikSMC$*I0AtQ>qa@NnNGUDT!;#EJXK9`KvU&6r{(pc%$pTG+VDl?js@#mC@C5!6b3 z6YwW@%N5ced=v08cleh6Y2bc2?UHN|nYkHSMsc$r|?|i4e zG~;=F8OZBPlbF|+f!Xw3Fhk#k4t+5l=hN3CUV?owD7{MhhbsM|i^7fV8m&d)~fZAHr>16{_q(UdC&VFmGh&KkQT?>{KD_*rXf7b&l;jJkKc_DinG}c2gMmd9xcV3OfmM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2TT(UkJ5b?|NSI zH{H1D#@EUeuX@k*uCD;~4BiQEpVL;R`LDQflag||RmCIP4r=&QN{U;#eub*I@7dnA zwJq$x%xUwx6mgIHK6Og8wNGp7jz0X2nr{4k$wyq{dwa~+KeFn<+8u9s`p)B*zwfsP zUV46CuI`@emEW~pulyR{{r9+3MO7=R-{@O5_k}NhaLdtUl^<>UMK8&;G*wEV&x-bC zZJnBHuiG`RnGdQGIH20Yhf^&$p2ANd_>gKB4($#iFw>D2B?OtadEv5-wzlPME8ACg zF7I5rA7Fdi^7gj2b_V}?!PnjG)DbpwU3ar+yY6l3b=Qe|e*LZAPJQq8lQ+Kma~Hn$ z&;utv{INehd5!Ade9Ir_KXmsk6E&w7J$~aiKlbGPKU(s4H}6Px-0_X;H$K(UxKJC9 zmR|FTmxp2x{_DZt|Eurv*S=oAdrimnKe?&#<3p4GtKHR9@!*=@fBD{Dzwmdb-Pixm zmgO&M_kDlJ^_!NthVS#MUP(Xm^*fZG+*dZRYq5&iQJm_*gf8f%=XU?b)zx$3&W1;R zENnJ`;O+(-r>T{c!%Zzuc0T+EMmg&t1Q1d%=Hr;g47K_`i_3_4;qR zhPMU}o|*dm1C3`|GRwDo@?)>+1NYpig&uvNul;&uFD88#T&``)Uv2u?y~W|Z_gvmq z;qcbdb`|MeRo&0K5-Sf!UJB_0+esjgg zA85UI%R9pdqt7@ki-~t%H+9p^U!PmK_ZMIL_^lJCl0RQ_>&2(v{@H`C-~WMV=HTxZ z=~pf8fAb3qpZWNU-}>aU;oo2Kz3z8Ze)&7yU#|4Le!=ydpZLeCs-FDJFCM5~^U>S> z`_A0W$3DNxJNF-MjYQ^bn!obw@7Iq%G2AfvrQiS3^SjT#`OXg>x#+-CpZoO9KYHfa W!r+x>uG--}wDyVQt@zb9KK}ueX!>LT literal 0 HcmV?d00001 diff --git a/Code/App.config b/Code/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/Code/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Code/Ceed.csproj b/Code/Ceed.csproj new file mode 100644 index 0000000..9b0d9ba --- /dev/null +++ b/Code/Ceed.csproj @@ -0,0 +1,108 @@ + + + + + Debug + AnyCPU + {620469D7-2681-47A7-9572-F0833596F9ED} + Exe + Ceed__c___speed___lightSpeed_ + Ceed %28c - speed __lightSpeed%29 + v4.7.2 + 512 + true + true + false + C:\Users\djkato\source\CeedPublish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 1 + 1.0.0.%2a + false + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + 69D7AE3C70A42E77F0500C8472DC5456AC045D0E + + + Ceed %28c - speed __lightSpeed%29_TemporaryKey.pfx + + + true + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + False + Microsoft .NET Framework 4.7.2 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + + + + + + \ No newline at end of file diff --git a/Code/Ceed.csproj.user b/Code/Ceed.csproj.user new file mode 100644 index 0000000..7fb918e --- /dev/null +++ b/Code/Ceed.csproj.user @@ -0,0 +1,17 @@ + + + + + + + + + + en-US + false + ProjectFiles + + + false + + \ No newline at end of file diff --git a/Code/Ceed.sln b/Code/Ceed.sln new file mode 100644 index 0000000..a62555a --- /dev/null +++ b/Code/Ceed.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29424.173 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ceed", "Ceed.csproj", "{620469D7-2681-47A7-9572-F0833596F9ED}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {620469D7-2681-47A7-9572-F0833596F9ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {620469D7-2681-47A7-9572-F0833596F9ED}.Debug|Any CPU.Build.0 = Debug|Any CPU + {620469D7-2681-47A7-9572-F0833596F9ED}.Release|Any CPU.ActiveCfg = Release|Any CPU + {620469D7-2681-47A7-9572-F0833596F9ED}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {9E12DDD1-E615-4820-80E0-0D75A25EE98F} + EndGlobalSection +EndGlobal diff --git a/Code/CeedMain/Main.cs b/Code/CeedMain/Main.cs new file mode 100644 index 0000000..f55239a --- /dev/null +++ b/Code/CeedMain/Main.cs @@ -0,0 +1,259 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using SpaceShooter; + +namespace CeedMain +{ + class Program + { + static void Main() + { + int gameStartAction = 0; + //GAMELOOP + while (true) + { + int turnNumber = 0; + Console.SetWindowSize(124, 50); + //MAIN MENU + if (turnNumber == 0) + { + gameStartAction = Renderer.GameStartMenu(false); + } + if (gameStartAction == 2) + { + gameStartAction = Renderer.GameStartMenu(true); + } + if (gameStartAction == 3) + { + break; + } + if (gameStartAction == 1) + { + while (true)//GAME STARTS HERE + { + + bool IWANTTOLEAVE = false; + //INIT PLAYERSHIP + PlayerShip playerShip = new PlayerShip + { + shipHealth = 20, + shipAttackDmg = 1, + shipSpeed = 1, + scannerAmount = 5, + fuelAmount = 20, + Money = 0, + totalDestroyedAsteroids = 0, + totalKilledPirateAmnt = 0 + }; + while (true) //SYSTEM STATS HERE + { + //setup console + Console.SetWindowSize(124, 50); + + //increment explred systems + playerShip.exploredSystemsAmount++; + + //INIT SOLAR SYSTEM + SolarSystem newSolarSystem = new SolarSystem + { + hasAsteroids = SolarSystem.GetRandomBool(), + planetAmount = SolarSystem.SetPlanetAmount(), + hasElectricClouds = SolarSystem.GetRandomBool(), + name = SolarSystem.GenerateName(), + hostility = 0 + }; + + //CREATE AND STORE PLANETS ON A LIST + for (int i = 0; i < newSolarSystem.planetAmount; i++) + { + Planet newPlanet = new Planet + { + areResources = Planet.SetResources(), + isFuel = Planet.SetFuel(), + occupiedByLiving = Planet.SetOccupation(), + name = Planet.GenerateName(), + isDiscovered = false + }; + + //IF THERES INTELIGENT LIFE(newplnt.living==2) SET ITS HOSTILITY AND UPDATE SYSTEMS HOSTILITY TO THE NEW HIGHEST ONE + if (newPlanet.occupiedByLiving == 2) + { + newPlanet.hostility = Planet.SetHostility(); + if (newPlanet.hostility > newSolarSystem.hostility) + { + newSolarSystem.hostility = newPlanet.hostility; + } + + } + else + { + newPlanet.hostility = 0; + } + + //IF PRIMITIVE LIFE = FUEL.TRUE; IF INTELIGENT LIFE=RESORUCES.TRUE, FUEL.TRUE + if (newPlanet.occupiedByLiving == 1) + { + newPlanet.isFuel = true; + + } + else if (newPlanet.occupiedByLiving == 2) + { + newPlanet.isFuel = true; + newPlanet.areResources = true; + } + + newSolarSystem.planetsList.Add(newPlanet); + + } + + //GAME STARTS HERE + while (true) + { + Console.SetWindowSize(124, 50); + + if (playerShip.fuelAmount <= 0 || playerShip.shipHealth <= 0) + { + Console.BackgroundColor = ConsoleColor.DarkMagenta; + Console.ForegroundColor = ConsoleColor.White; + Console.Clear(); + Console.WriteLine(); + Console.WriteLine("You ran out of either HP or Fuel, so you lost!"); + Console.WriteLine("Press any key to go to main menu..."); + Console.ReadKey(); + IWANTTOLEAVE = true; + break; + } + + //IF ITS THE 5TH TURN, ADD SHOP TO SOLARSYSTEM + if (playerShip.exploredSystemsAmount % 3 == 0) + { + newSolarSystem.shop = true; + } + + + //RENDER GUI + int input1 = Renderer.ChooseAction(newSolarSystem, newSolarSystem.planetsList, playerShip); + + //PLAYER WANTS EXPLORE + if (input1 == 1) + { + Console.WriteLine(); + Console.WriteLine("type the index number of the planet you want to explore[ENTER]..."); + int input2 = Convert.ToInt32(Console.ReadLine()); //GETS PLAYERS INDEX OF EXPLORE + + // CHECKS IF THE PLANET CAN BE EXPLORED + if (newSolarSystem.planetsList[input2].isDiscovered) + { + + newSolarSystem.planetsList[input2].isExplored = true; + + //IF PLANET HAS FUEL, ADD FUEL TO SHIP + if (newSolarSystem.planetsList[input2].isFuel) + { + playerShip.fuelAmount += Planet.AddRandomFuelAmount(); + newSolarSystem.planetsList[input2].isFuel = false; + } + + //STARTS MINIGAME IF HOSTILITY > 0 + if(newSolarSystem.planetsList[input2].hostility > 0 || newSolarSystem.hasAsteroids) + { + playerShip = SpaceShooter.MainProgram.ShooterMain(playerShip, newSolarSystem, input2); + } + + + if (newSolarSystem.planetsList[input2].areResources) + { + newSolarSystem.planetsList[input2].areResources = false; + playerShip.scannerAmount += 1; + } + } + + // IF THE PLAYERS INDEX ISNT EPLOREABLE + else + { + Console.WriteLine(); + Console.WriteLine("You cant explore this planet, you havent discovered it yet"); + Console.WriteLine("Press Any key to continue..."); + Console.ReadKey(); + + } + } + else if (input1 == 2) //PLAYER WANTS TO SCAN + { + if (playerShip.scannerAmount > 0) + { + playerShip.scannerAmount -= 1; + int[] scanIndexes = PlayerShip.GetScanIndexes(newSolarSystem); //RETURNS ARRAY OF RANDOM INDEXES TO SCAN + foreach (int a in scanIndexes) //MAKES INDEXES DISCOVERED + { + newSolarSystem.planetsList[a].isDiscovered = true; + } + } + else + { + Console.WriteLine("You dont have enough Scanners!"); + Console.WriteLine("Press any key to continue..."); + Console.ReadKey(); + } + } + else if (input1 == 3) //PLAYER WANDERS + { + int randomPlanetIndex = newSolarSystem.planetsList.IndexOf(newSolarSystem.planetsList[PlayerShip.Wander(newSolarSystem)]); + playerShip = SpaceShooter.MainProgram.ShooterMain(playerShip,newSolarSystem , randomPlanetIndex); + newSolarSystem.planetsList[randomPlanetIndex].isDiscovered = true; + newSolarSystem.planetsList[randomPlanetIndex].isExplored = true; + if (newSolarSystem.planetsList[randomPlanetIndex].isFuel) + { + playerShip.fuelAmount += Planet.AddRandomFuelAmount(); + newSolarSystem.planetsList[randomPlanetIndex].isFuel = false; + } + if (newSolarSystem.planetsList[randomPlanetIndex].areResources) + { + playerShip.scannerAmount += 1; + newSolarSystem.planetsList[randomPlanetIndex].areResources = false; + } + playerShip.fuelAmount -= 3; + + } + else if (input1 == 4) //NEW GALAXY + { + playerShip.fuelAmount -= 10; + break; + } + else if(input1 == 5)//SHOP + { + playerShip = Renderer.Shop(playerShip); + } + else if(input1 == 6) + { + IWANTTOLEAVE = true; + break; + } + + } + + if(IWANTTOLEAVE) + { + break; + } + + } + if (IWANTTOLEAVE) + { + IWANTTOLEAVE = false; + break; + } + } + + + } + } + + + + } + } +} diff --git a/Code/CeedMain/PirateShip.cs b/Code/CeedMain/PirateShip.cs new file mode 100644 index 0000000..250a7a0 --- /dev/null +++ b/Code/CeedMain/PirateShip.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CeedMain +{ + class PirateShip : ShipTemplate + { + + } +} diff --git a/Code/CeedMain/Planet.cs b/Code/CeedMain/Planet.cs new file mode 100644 index 0000000..31cfd17 --- /dev/null +++ b/Code/CeedMain/Planet.cs @@ -0,0 +1,93 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CeedMain +{ + class Planet + { + private static readonly Random _random = new Random(); + public string name; + public bool isExplored; + public int hostility; //0 = peaceful ... 5 = deadly + public int occupiedByLiving; //0 == no;1==primitive;2==intelligent + public bool isFuel; + public bool areResources; + public bool isDiscovered; + + public static int AddRandomFuelAmount() + { + return (_random.Next(1, 5)); + } + public static int SetOccupation() + { + + int tmp = _random.Next(0, 2); + if (tmp == 1) + { + return _random.Next(1, 3); + } + else + { + return 0; + } + } + + public static bool SetFuel() + { + + int tmp = _random.Next(0, 2); + if (tmp == 1) + { + return true; + } + else + { + return false; + } + + } + + public static bool SetResources() + { + + int tmp = _random.Next(0, 2); + if (tmp == 1) + { + return true; + } + else + { + return false; + } + } + + public static int SetHostility() + { + + int tmp = _random.Next(1, 6); + return tmp; + } + + public static string GenerateName() + { + char[] chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray(); + + + int letterLength = _random.Next(1, 10); + + string name = ""; + int i; + for (int f = 0; f < letterLength; f++) + { + i = _random.Next(chars.Length); + name += Char.ToString(chars[i]); + } + + return name; + } + + } +} diff --git a/Code/CeedMain/PlayerShip.cs b/Code/CeedMain/PlayerShip.cs new file mode 100644 index 0000000..3b7a9b8 --- /dev/null +++ b/Code/CeedMain/PlayerShip.cs @@ -0,0 +1,94 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CeedMain +{ + class PlayerShip : ShipTemplate + { + + private static readonly Random _random = new Random(); + public int scannerAmount; + public int fuelAmount; + public int exploredSystemsAmount; + public int Money; + + //SpaceShooter vars + public int totalKilledPirateAmnt = 0; + public int totalDestroyedAsteroids = 0; + public int killedPirateAmnt = 0; + public bool isFiring = false; + public int shipPosY = SpaceShooter.Render.yGridSize * 2 / 3; + public int shipPosX = SpaceShooter.Render.xGridSize / 2; + public string[,] shipModel = new string[4, 10]; + + //OG methods + public static int[] GetScanIndexes(SolarSystem newSolarSytem) + { + var scanAmnt = _random.Next(0, newSolarSytem.planetAmount); + int[] scanIndexs = new int[scanAmnt]; + for (int i = 0; i < scanAmnt; i++) + { + scanIndexs[i] = _random.Next(0, newSolarSytem.planetAmount); + } + return scanIndexs; + + } + public static int Wander(SolarSystem newSolarSystem) + { + return (_random.Next(0, newSolarSystem.planetAmount)); + } + + //SpaceShooter Methods + public static string[,] SetShipModel() + { + string[,] shipGraphic = new string[4, 10]; + shipGraphic[0, 0] = " "; + shipGraphic[0, 1] = " "; + shipGraphic[0, 2] = " "; + shipGraphic[0, 3] = " "; + shipGraphic[0, 4] = "_"; + shipGraphic[0, 5] = "_"; + shipGraphic[0, 6] = " "; + shipGraphic[0, 7] = " "; + shipGraphic[0, 8] = " "; + shipGraphic[0, 9] = " "; + + shipGraphic[1, 0] = " "; + shipGraphic[1, 1] = " "; + shipGraphic[1, 2] = " "; + shipGraphic[1, 3] = "/"; + shipGraphic[1, 4] = " "; + shipGraphic[1, 5] = " "; + shipGraphic[1, 6] = @"\"; + shipGraphic[1, 7] = " "; + shipGraphic[1, 8] = " "; + shipGraphic[1, 9] = " "; + + shipGraphic[2, 0] = "|"; + shipGraphic[2, 1] = " "; + shipGraphic[2, 2] = "_"; + shipGraphic[2, 3] = "|"; + shipGraphic[2, 4] = " "; + shipGraphic[2, 5] = " "; + shipGraphic[2, 6] = "|"; + shipGraphic[2, 7] = "_"; + shipGraphic[2, 8] = " "; + shipGraphic[2, 9] = "|"; + + shipGraphic[3, 0] = "|"; + shipGraphic[3, 1] = "="; + shipGraphic[3, 2] = "|"; + shipGraphic[3, 3] = "_"; + shipGraphic[3, 4] = "|"; + shipGraphic[3, 5] = "|"; + shipGraphic[3, 6] = "_"; + shipGraphic[3, 7] = "|"; + shipGraphic[3, 8] = "="; + shipGraphic[3, 9] = "|"; + return shipGraphic; + } + } +} diff --git a/Code/CeedMain/Renderer.cs b/Code/CeedMain/Renderer.cs new file mode 100644 index 0000000..e3bbb4d --- /dev/null +++ b/Code/CeedMain/Renderer.cs @@ -0,0 +1,413 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Http.Headers; +using System.Text; +using System.Threading.Tasks; + +namespace CeedMain +{ + class Renderer + { + + public static int GameStartMenu(bool gameContinuePressed) + { + + + Console.BackgroundColor = ConsoleColor.DarkMagenta; + Console.Clear(); + Console.WriteLine(); + Console.ForegroundColor = ConsoleColor.White; + Console.WriteLine("Welcome to"); + Console.ForegroundColor = ConsoleColor.Magenta; + Console.WriteLine("CeeD"); + Console.ForegroundColor = ConsoleColor.White; + Console.WriteLine(); + Console.WriteLine("Game Rules: The point of the game is to explore as many Solar Systems as possible. Each system has"); + Console.WriteLine("a random amount of Fuel and Resources. Fuel gives you fuel, and Resources give you Scanners, which"); + Console.WriteLine("is an ability to randomly scout out planets, and find out of their details."); + Console.WriteLine("When you start a new game, youll see that you dont know any of the planets, and thats becaue you"); + Console.WriteLine("Havent discovered their location yet, you just see they exist. You use the scanner to find where they are,"); + Console.WriteLine("and if they are worth exploring. Exploring means going to the planet and taking its Resources and Fuel, but"); + Console.WriteLine("be warned, some planets have intelligent life, and can be Hazardous. If you explore a dangerous planet, youll"); + Console.WriteLine("take damage, try to not die! If you run out of scanners, you can use Wander, but that consumes fuel, which is limited"); + Console.WriteLine("too. Every fuel reserve gives you between 1-5 fuel."); + Console.WriteLine("When referencing Planets, Index refers to the number inside the square brackets, for example:"); + Console.WriteLine("RANDOMNAME[1] <- in that case index is 1"); + Console.WriteLine("When using actions, press the index number after it, in the case of Explore, type numbers after it n press enter to submit."); + Console.WriteLine("Minigame Controls:"); + Console.WriteLine("Movement: WASD"); + Console.WriteLine("Shoot: Spacebar"); + Console.ForegroundColor = ConsoleColor.Red; + Console.WriteLine("Try not to die, Good luck ;)"); + Console.ForegroundColor = ConsoleColor.Gray; + Console.WriteLine(); + Console.WriteLine(); + Console.WriteLine("Start new game [SPACE]"); + Console.WriteLine(); + Console.WriteLine(); + if (gameContinuePressed == true) + { + Console.WriteLine("CURRENTLY UNSUPPORTED!"); + } + else + { + Console.WriteLine("Continue game [L]"); + } + Console.WriteLine(); + Console.WriteLine(); + Console.WriteLine("Close game at any time: CTRL + C"); + var input = Console.ReadKey(); + if (input.Key == ConsoleKey.Spacebar) + { + return (1); + } + if (input.Key == ConsoleKey.L) + { + return (2); + } + if (input.Key == ConsoleKey.Escape) + { + return (3); + } + else + { + return (0); + } + } + + /*public static int SystemScreen(int scannerAmount, int fuelAmount, string systemName) + { + + Console.BackgroundColor = ConsoleColor.DarkMagenta; + Console.Clear(); + Console.WriteLine(); + Console.ForegroundColor = ConsoleColor.White; + Console.WriteLine(); + Console.WriteLine("Welcome to System " + systemName); + Console.WriteLine(); + Console.WriteLine(); + if (scannerAmount > 0) + { + Console.WriteLine("Scan System(-1 Scanner{Currently have: " + scannerAmount + ") [1]"); + } + Console.WriteLine(); + if (fuelAmount > 2) + { + Console.WriteLine("Explore System(-2 Fuel{Currently have: " + fuelAmount + ") [2]"); + } + Console.WriteLine(); + Console.WriteLine("Strand [3]"); + Console.WriteLine(); + Console.WriteLine("RageQuit [ESC]"); + + while (true) + { + var input = Console.ReadKey(); + if (input.Key == ConsoleKey.NumPad1) + { + return (1); + } + if (input.Key == ConsoleKey.NumPad2) + { + return (2); + } + if (input.Key == ConsoleKey.NumPad3) + { + return (3); + } + if (input.Key == ConsoleKey.Escape) + { + return (4); + + } + else + { + + } + } + }*/ //DEAD CODE + + public static void DebugScan(SolarSystem newSolarSytem, List planetList) + { + + Console.BackgroundColor = ConsoleColor.DarkMagenta; + Console.Clear(); + Console.WriteLine(); + Console.ForegroundColor = ConsoleColor.White; + Console.WriteLine("Scan results of the system " + newSolarSytem.name + ":"); + string hostilityConverted = ""; + + switch (newSolarSytem.hostility) //Draw Hostility + { + case 0: + hostilityConverted = "Peaceful"; + break; + case 1: + hostilityConverted = "Passive"; + break; + case 2: + hostilityConverted = "Cautious"; + break; + case 3: + hostilityConverted = "Scary"; + break; + case 4: + hostilityConverted = "Dangerous"; + break; + case 5: + hostilityConverted = "Deadly"; + break; + } + Console.WriteLine(); + Console.WriteLine("System is " + hostilityConverted); + + + if (newSolarSytem.hasAsteroids == true) + { + Console.WriteLine(); + Console.WriteLine(); + Console.WriteLine("System contains Asteroid fields"); + } + + if (newSolarSytem.hasAsteroids == true) + { + Console.WriteLine(); + Console.WriteLine(); + Console.WriteLine("System has electric field disturbences present"); + } + + Console.WriteLine(); + Console.WriteLine(); + Console.WriteLine("There are " + newSolarSytem.planetAmount + " planets:"); + + Console.WriteLine(); + Console.WriteLine("-name | hostility | Resources | Fuel | Occupied"); + + foreach (Planet a in planetList) + { + Console.WriteLine(); + Console.Write("- " + a.name); + Console.Write("| " + a.hostility); + Console.Write(" | " + a.areResources); + Console.Write(" | " + a.isFuel); + Console.Write(" | " + a.occupiedByLiving); + a.isDiscovered = true; + } + + Console.ForegroundColor = ConsoleColor.Gray; + Console.WriteLine(); + Console.WriteLine(); + Console.WriteLine("press any key to continue.."); + Console.WriteLine(); + Console.ReadKey(); + } + + public static int ChooseAction(SolarSystem newSolarSystem, List planetList, PlayerShip playerShip) + { + + Console.BackgroundColor = ConsoleColor.DarkMagenta; + Console.ForegroundColor = ConsoleColor.White; + Console.Clear(); + Console.WriteLine(); + Console.WriteLine(); + Console.WriteLine("Welcome to System " + newSolarSystem.name + ", What would you like to do?"); + Console.WriteLine(); + Console.WriteLine(); + Console.WriteLine("Your ship data:"); + Console.WriteLine(); + Console.WriteLine("-Systems Explored: " + playerShip.exploredSystemsAmount); + Console.WriteLine("-Fuel: " + playerShip.fuelAmount); + Console.WriteLine("-Health: " + playerShip.shipHealth); + Console.WriteLine("-Money: " + playerShip.Money + "đ"); + Console.WriteLine("-Scanner Amount: " + playerShip.scannerAmount); + Console.WriteLine("-Total ships destroyed: " + playerShip.totalKilledPirateAmnt); + Console.WriteLine("-total asteroids destroyed: " + playerShip.totalDestroyedAsteroids); + Console.WriteLine(); + Console.WriteLine(); + if (newSolarSystem.hasAsteroids) + { + Console.WriteLine("Solar System has asteroid belts, be wary!"); + } + + Console.WriteLine(); + + if (newSolarSystem.shop) + { + Console.WriteLine("Enter Shop[B/5]"); + } + Console.WriteLine(); + Console.WriteLine(); + Console.WriteLine("There are " + newSolarSystem.planetAmount + " planets:"); + Console.WriteLine(); + Console.WriteLine(); + for (int i = 0; i < newSolarSystem.planetAmount; i++) + { + if (planetList[i].isDiscovered == true) + { + string consoleOutput = "-" + planetList[i].name + "[" + i + "]"; + + if (planetList[i].hostility > 0) + { + consoleOutput += " |hostility:" + planetList[i].hostility; + } + + if (planetList[i].isFuel) + { + consoleOutput += " |Fuel:" + planetList[i].isFuel; + } + + if (planetList[i].areResources) + { + consoleOutput += " |Resources:" + planetList[i].areResources; + } + if (planetList[i].isExplored) + { + consoleOutput += "! HAS BEEN EXPLORED !"; + } + Console.WriteLine(consoleOutput); + } + else + { + Console.WriteLine("-" + "???"); + } + } + Console.WriteLine(); + Console.WriteLine(); + Console.WriteLine("Explore[E/1]"); + Console.WriteLine(); + Console.WriteLine("Scan[S/2]"); + Console.WriteLine(); + Console.WriteLine("Wander[W/3]"); + Console.WriteLine(); + Console.WriteLine("Move to next System(uses 10 fuel)[4,Q]"); + Console.WriteLine(); + Console.WriteLine("Ragequit[ESC]"); + + while (true) //WAIT FOR INPUT + { + var input = Console.ReadKey(); + if (input.Key == ConsoleKey.NumPad1 || input.Key == ConsoleKey.E) + { + return 1; + } + else if (input.Key == ConsoleKey.NumPad2 || input.Key == ConsoleKey.S) + { + return (2); + } + else if (input.Key == ConsoleKey.NumPad3 || input.Key == ConsoleKey.W) + { + return (3); + } + else if (input.Key == ConsoleKey.NumPad4 || input.Key == ConsoleKey.Q) + { + return (4); + } + + else if (input.Key == ConsoleKey.NumPad5 || input.Key == ConsoleKey.B) + { + return (5); + } + + else if (input.Key == ConsoleKey.Escape) + { + return (6); + } + + } + + } + + public static PlayerShip Shop(PlayerShip playerShip) + { + + while (true) + { + + Console.BackgroundColor = ConsoleColor.DarkMagenta; + Console.ForegroundColor = ConsoleColor.White; + Console.Clear(); + Console.WriteLine(); + Console.WriteLine(); + Console.WriteLine("Welcome to the shop!"); + Console.WriteLine(); + Console.WriteLine(); + Console.WriteLine("Your ship data:"); + Console.WriteLine(); + Console.WriteLine("-Systems Explored: " + playerShip.exploredSystemsAmount); + Console.WriteLine("-Fuel: " + playerShip.fuelAmount); + Console.WriteLine("-Health: " + playerShip.shipHealth); + Console.WriteLine("-Money: " + playerShip.Money + "đ"); + Console.WriteLine("-Scanner Amount: " + playerShip.scannerAmount); + Console.WriteLine("-Total ships destroyed: " + playerShip.totalKilledPirateAmnt); + Console.WriteLine("-total asteroids destroyed: " + playerShip.totalDestroyedAsteroids); + Console.WriteLine(); + Console.WriteLine(); + Console.WriteLine(); + Console.WriteLine("Fix ship(+1hp, -5đ)[1]"); + Console.WriteLine(); + Console.WriteLine("Buy 1 Scanner(10đ)[2]"); + Console.WriteLine(); + Console.WriteLine("Buy 1 Fuel(2đ)[3]"); + Console.WriteLine(); + Console.WriteLine("Exit[ESC]"); + + var input = Console.ReadKey(); + if (input.Key == ConsoleKey.NumPad1) + { + if (playerShip.Money >= 5) + { + if (playerShip.shipHealth <= 20) + { + playerShip.Money -= 5; + playerShip.shipHealth += 1; + } + else + { + Console.WriteLine("Youre at full health/out of money!"); + Console.ReadKey(); + } + } + } + else if (input.Key == ConsoleKey.NumPad2) + { + if (playerShip.Money >= 10) + { + playerShip.Money -= 10; + playerShip.scannerAmount += 1; + } + else + { + Console.WriteLine("Youre out of money!"); + Console.ReadKey(); + } + } + else if (input.Key == ConsoleKey.NumPad3 || input.Key == ConsoleKey.W) + { + if (playerShip.Money >= 2) + { + playerShip.Money -= 2; + playerShip.fuelAmount += 1; + } + else + { + Console.WriteLine("Youre out of money!"); + Console.ReadKey(); + } + } + + else if (input.Key == ConsoleKey.Escape) + { + + return playerShip; + } + + + } + + + + } + } + +} diff --git a/Code/CeedMain/ShipTemplate.cs b/Code/CeedMain/ShipTemplate.cs new file mode 100644 index 0000000..e74cb07 --- /dev/null +++ b/Code/CeedMain/ShipTemplate.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CeedMain +{ + class ShipTemplate + { + public int shipSpeed; + public int shipAttackDmg; + public int shipHealth; + } +} diff --git a/Code/CeedMain/SolarSystem.cs b/Code/CeedMain/SolarSystem.cs new file mode 100644 index 0000000..5604547 --- /dev/null +++ b/Code/CeedMain/SolarSystem.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace CeedMain +{ + class SolarSystem + { + private static readonly Random _random = new Random(); + public List planetsList = new List(); + public string name; + public int hostility; //0 = peaceful ... 5 = deadly + public int planetAmount; + public int occupiedByLiving; //0 == no;1==primitive;2==intelligent + public bool hasAsteroids; + public bool shop; + public bool hasElectricClouds; + + public static string GenerateName() + { + char[] chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray(); + + + int letterLength = _random.Next(1, 5); + int numberLength = _random.Next(1, 10); + string name = ""; + int i; + for (int f = 0; f < letterLength; f++) + { + i = _random.Next(chars.Length); + name += Char.ToString(chars[i]); + } + name += "-"; + for (int f = 0; f < numberLength; f++) + { + name += _random.Next(0, 9).ToString(); + } + + return (name); + } + public static int SetPlanetAmount() + { + + + return (_random.Next(2, 13)); + } + public static int SetMoonAmount() + { + + + return (_random.Next(0, 6)); + } + public static bool GetRandomBool() + { + + var temp = _random.Next(0, 2); + if (temp == 0) + { + return false; + } + if (temp == 1) + { + return true; + } + else { return false; } + } + } +} diff --git a/Code/Properties/AssemblyInfo.cs b/Code/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..5ac7d97 --- /dev/null +++ b/Code/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Ceed (c - speed __lightSpeed)")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Ceed (c - speed __lightSpeed)")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("620469d7-2681-47a7-9572-f0833596f9ed")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Code/SpaceShooter/Assets.txt b/Code/SpaceShooter/Assets.txt new file mode 100644 index 0000000..42d7390 --- /dev/null +++ b/Code/SpaceShooter/Assets.txt @@ -0,0 +1,25 @@ +ENEMY SHIP + __||__ +|=\ || /=| + \__/ + +Friendly Ship + __ + / \ +| _| |_ | +|=|_||_|=| + +Asteroid + ___ +/ \_ +| \ +\ / + \___/ + Bun + +(\ /) +( . .) +c(") (") + +--MAKE THE WINDOW POS SHAKE WHEN HIT +--MAKE OPTIONS > B/W MODE FOR FPS IMPROVEMENT, BUT ADD COLORS \ No newline at end of file diff --git a/Code/SpaceShooter/Asteroid.cs b/Code/SpaceShooter/Asteroid.cs new file mode 100644 index 0000000..11afeb3 --- /dev/null +++ b/Code/SpaceShooter/Asteroid.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SpaceShooter +{ + class Asteroid + { + public static readonly Random _random = new Random(); + public int asteroidPosX; + public int asteroidPosY; + public int speed; + public string[,] AsteroidModel = new string[5,7]; + public static string[,] SetAsteroidModel() + { + string[,] asteroidGraphic = new string[5,7]; + + asteroidGraphic[0, 0] = " "; + asteroidGraphic[0, 1] = "_"; + asteroidGraphic[0, 2] = "_"; + asteroidGraphic[0, 3] = "_"; + asteroidGraphic[0, 4] = " "; + asteroidGraphic[0, 5] = " "; + asteroidGraphic[0, 6] = " "; + + asteroidGraphic[1, 0] = "/"; + asteroidGraphic[1, 1] = " "; + asteroidGraphic[1, 2] = " "; + asteroidGraphic[1, 3] = " "; + asteroidGraphic[1, 4] = @"\"; + asteroidGraphic[1, 5] = "_"; + + asteroidGraphic[2, 0] = "|"; + asteroidGraphic[2, 1] = " "; + asteroidGraphic[2, 2] = " "; + asteroidGraphic[2, 3] = " "; + asteroidGraphic[2, 4] = " "; + asteroidGraphic[2, 5] = " "; + asteroidGraphic[2, 6] = @"\"; + + asteroidGraphic[3, 0] = @"\"; + asteroidGraphic[3, 1] = " "; + asteroidGraphic[3, 2] = " "; + asteroidGraphic[3, 3] = " "; + asteroidGraphic[3, 4] = " "; + asteroidGraphic[3, 5] = " "; + asteroidGraphic[3, 6] = "/"; + + asteroidGraphic[4, 0] = " "; + asteroidGraphic[4, 1] = @"\"; + asteroidGraphic[4, 2] = "_"; + asteroidGraphic[4, 3] = "_"; + asteroidGraphic[4, 4] = "_"; + asteroidGraphic[4, 5] = "/"; + asteroidGraphic[4, 6] = " "; + + return asteroidGraphic; + } + + } +} diff --git a/Code/SpaceShooter/DEADShip.cs b/Code/SpaceShooter/DEADShip.cs new file mode 100644 index 0000000..47e7c9a --- /dev/null +++ b/Code/SpaceShooter/DEADShip.cs @@ -0,0 +1,70 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SpaceShooter +{ + class DEADShip + { + public int killedPirateAmnt = 0; + public bool isFiring = false; + public static int speed; + public int health = 20; + public int shipPosY = Render.yGridSize*2/3 ; + public int shipPosX = Render.xGridSize/2; + public string[,] shipModel = new string[4, 10]; + public static string[,] SetShipModel() + { + string[,] shipGraphic= new string[4, 10]; + shipGraphic[0, 0] = " "; + shipGraphic[0, 1] = " "; + shipGraphic[0, 2] = " "; + shipGraphic[0, 3] = " "; + shipGraphic[0, 4] = "_"; + shipGraphic[0, 5] = "_"; + shipGraphic[0, 6] = " "; + shipGraphic[0, 7] = " "; + shipGraphic[0, 8] = " "; + shipGraphic[0, 9] = " "; + + shipGraphic[1, 0] = " "; + shipGraphic[1, 1] = " "; + shipGraphic[1, 2] = " "; + shipGraphic[1, 3] = "/"; + shipGraphic[1, 4] = " "; + shipGraphic[1, 5] = " "; + shipGraphic[1, 6] = @"\"; + shipGraphic[1, 7] = " "; + shipGraphic[1, 8] = " "; + shipGraphic[1, 9] = " "; + + shipGraphic[2, 0] = "|"; + shipGraphic[2, 1] = " "; + shipGraphic[2, 2] = "_"; + shipGraphic[2, 3] = "|"; + shipGraphic[2, 4] = " "; + shipGraphic[2, 5] = " "; + shipGraphic[2, 6] = "|"; + shipGraphic[2, 7] = "_"; + shipGraphic[2, 8] = " "; + shipGraphic[2, 9] = "|"; + + shipGraphic[3, 0] = "|"; + shipGraphic[3, 1] = "="; + shipGraphic[3, 2] = "|"; + shipGraphic[3, 3] = "_"; + shipGraphic[3, 4] = "|"; + shipGraphic[3, 5] = "|"; + shipGraphic[3, 6] = "_"; + shipGraphic[3, 7] = "|"; + shipGraphic[3, 8] = "="; + shipGraphic[3, 9] = "|"; + return shipGraphic; + } + + + } +} diff --git a/Code/SpaceShooter/GameLogic.cs b/Code/SpaceShooter/GameLogic.cs new file mode 100644 index 0000000..740043a --- /dev/null +++ b/Code/SpaceShooter/GameLogic.cs @@ -0,0 +1,254 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading.Tasks; +using CeedMain; + +namespace SpaceShooter +{ + class GameLogic + { + private static int pirateY = 0; + private static readonly int collisionDistShip = 5; + + private readonly static Random _random = new Random(); + + //SHIP STUFF + public static PlayerShip Controller(PlayerShip _ship) + { + while (true) + { + switch (Console.ReadKey(true).Key) + { + + case ConsoleKey.A: + if (_ship.shipPosX > 5) + { _ship.shipPosX--; } + break; + case ConsoleKey.D: + if (_ship.shipPosX < Render.xGridSize - 5) + { _ship.shipPosX++; } + break; + case ConsoleKey.W: + if (_ship.shipPosY > 3) + { _ship.shipPosY--; } + break; + case ConsoleKey.S: + if (_ship.shipPosY < Render.yGridSize - 3) + { _ship.shipPosY++; } + break; + case ConsoleKey.Spacebar: + _ship.isFiring = true; + break; + } + + return _ship; + + } + } + + //ASTEROID STUFF + public static Asteroid AsteroidGenerator() + { + Asteroid _asteroid = new Asteroid + { + asteroidPosX = _random.Next(-5, Render.xGridSize + 5), + asteroidPosY = 0, + AsteroidModel = Asteroid.SetAsteroidModel(), + speed = _random.Next(1, 3) + }; + return _asteroid; + + } + + public static Asteroid MoveAsteroid(Asteroid _asteroid) + { + _asteroid.asteroidPosY += _asteroid.speed; + return _asteroid; + + } + + //PIRATE STUFF + public static Pirate PirateLogic(Pirate _pirate, PlayerShip _ship) + { + //FOLLOW PLAYERS X AT OWN SPEED; IF PIRATE.PosX = ship.posX, shoot! + if (_pirate.shipPosY >= Render.yGridSize - 3) + { + _pirate.isOutsideBounds = true; + return _pirate; + } + + else + { + _pirate.targetX = _ship.shipPosX; + pirateY++; + + if (_pirate.shipPosX > _pirate.targetX && _pirate.shipPosX < _pirate.targetX+3 || _pirate.shipPosX < _pirate.targetX && _pirate.shipPosX > _pirate.targetX - 3) + { + _pirate.isFiringNum += 1; + if(_pirate.isFiringNum % 5 == 0) + { + + _pirate.isFiring = true; + } + + } + + else if (_pirate.shipPosX > _pirate.targetX) + { + _pirate.isFiring = false; + if (pirateY % 5 == 0) + { + _pirate.shipPosX -= _pirate.speed; + } + + } + else + { + _pirate.isFiring = false; + if (pirateY % 5 == 0) + { + _pirate.shipPosX += _pirate.speed; + } + } + //MOVES the PIRAte SLOOWLY DOWNWARDS + + + pirateY++; + if (pirateY % 5 == 0) + { + _pirate.shipPosY += 1; + } + + return _pirate; + } + } + + //COLISSION STUFF + public static int[] CollisionShipProjectile(PlayerShip _ship, List projectileList) + { + /**output[0] = index of collided element output[1] Damage ship takes **/ + int[] output = new int[2]; + output[0] = 0; + output[1] = 0; + foreach (Projectile a in projectileList) + { + if (a.shotByPlayer == false) + { + if ((_ship.shipPosX - a.position[1]) * (_ship.shipPosX - a.position[1]) + (_ship.shipPosY - a.position[0]) * (_ship.shipPosY - a.position[0]) < collisionDistShip * collisionDistShip) + { + output[0] = projectileList.IndexOf(a); + output[1] = 1; + break; + } + else + { + output[1] = 0; + } + } + } + return output; + } + + public static int[] CollisionShipAsteroid(PlayerShip _ship, List asteroidList) + { + /**output[0] = index of collided element output[1] Damage ship takes **/ + int[] output = new int[2]; + output[0] = 0; + output[1] = 0; + foreach (Asteroid a in asteroidList) + { + if ((_ship.shipPosX - a.asteroidPosX) * (_ship.shipPosX - a.asteroidPosX) + (_ship.shipPosY - a.asteroidPosY) * (_ship.shipPosY - a.asteroidPosY) < collisionDistShip * collisionDistShip) + { + output[0] = asteroidList.IndexOf(a); + output[1] = 2; + break; + } + else + { + output[1] = 0; + } + } + return output; + } + + public static int[] CollisionShipPirate(PlayerShip _ship, List pirateList) + { + /**output[0] = index of collided element output[1] Damage ship takes **/ + int[] output = new int[2]; + output[0] = 0; + output[1] = 0; + foreach (Pirate a in pirateList) + { + if ((_ship.shipPosX - a.shipPosX) * (_ship.shipPosX - a.shipPosX) + (_ship.shipPosY - a.shipPosY) * (_ship.shipPosY - a.shipPosY) < collisionDistShip * collisionDistShip) + { + output[0] = pirateList.IndexOf(a); + output[1] = 2; + break; + } + else + { + output[1] = 0; + } + } + return output; + } + + public static int[] CollisionPirateProjectile(List projectileList, List pirateList) + { + /**output[0] = index of collided projectile, output[1] Damage ship takes, output[2] Index of pirate **/ + int[] output = new int[3]; + foreach (Projectile a in projectileList) + { + foreach (Pirate b in pirateList) + { + if (a.shotByPlayer == true) + { + if ((b.shipPosX - a.position[1]) * (b.shipPosX - a.position[1]) + (b.shipPosY - a.position[0]) * (b.shipPosY - a.position[0]) < collisionDistShip * collisionDistShip) + { + output[0] = projectileList.IndexOf(a); + output[1] = 1; + output[2] = pirateList.IndexOf(b); + break; + } + } + else + { + output[1] = 0; + } + } + } + return output; + } + public static int[] CollisionAsteroidProjectile(List projectileList, List asteroidList) + { + /**output[0] = index of collided projectile, output[1] Damage ship takes, output[2] Index of pirate **/ + int[] output = new int[3]; + foreach (Projectile a in projectileList) + { + foreach (Asteroid b in asteroidList) + { + if (a.shotByPlayer == true) + { + if ((b.asteroidPosX - a.position[1]) * (b.asteroidPosX - a.position[1]) + (b.asteroidPosY - a.position[0]) * (b.asteroidPosY - a.position[0]) < collisionDistShip * collisionDistShip) + { + output[0] = projectileList.IndexOf(a); + output[1] = 1; + output[2] = asteroidList.IndexOf(b); + break; + } + } + else + { + output[1] = 0; + } + } + } + return output; + } + } + +} diff --git a/Code/SpaceShooter/Pirate.cs b/Code/SpaceShooter/Pirate.cs new file mode 100644 index 0000000..6eea801 --- /dev/null +++ b/Code/SpaceShooter/Pirate.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SpaceShooter +{ + class Pirate + { + public bool isFiring; + public int isFiringNum = 0; + public int health = 3; + public int shipPosX = Render.xGridSize/2; + public int shipPosY = 2; + public int targetX; + public int speed = 1; + public string[,] shipModel = new string[4, 6]; + public bool isOutsideBounds = false; + public static string[,] SetShipModel() + { + + string[,] result = new string[3, 10]; + + result[0, 0] = " "; + result[0, 1] = " "; + result[0, 2] = "_"; + result[0, 3] = "_"; + result[0, 4] = "|"; + result[0, 5] = "|"; + result[0, 6] = "_"; + result[0, 7] = "_"; + result[0, 8] = " "; + result[0, 9] = " "; + + result[1, 0] = "|"; + result[1, 1] = "="; + result[1, 2] = @"\"; + result[1, 3] = " "; + result[1, 4] = "|"; + result[1, 5] = "|"; + result[1, 6] = " "; + result[1, 7] = "/"; + result[1, 8] = "="; + result[1, 9] = "|"; + + result[2, 0] = " "; + result[2, 1] = " "; + result[2, 2] = " "; + result[2, 3] = @"\"; + result[2, 4] = "_"; + result[2, 5] = "_"; + result[2, 6] = "/"; + result[2, 7] = " "; + result[2, 8] = " "; + result[2, 9] = " "; + return result; + } + + } +} diff --git a/Code/SpaceShooter/Projectile.cs b/Code/SpaceShooter/Projectile.cs new file mode 100644 index 0000000..4070996 --- /dev/null +++ b/Code/SpaceShooter/Projectile.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SpaceShooter +{ + class Projectile + { + public string[,] positionGrid = new string[Render.yGridSize, Render.xGridSize]; + public static int speed = 2; + public int[] position = new int[2]; + public bool shotByPlayer; + public bool isOutsideBounds = false; + public static Projectile CreateProjectile(int[] position, bool shotByPlayer) + { + + Projectile _projectile = new Projectile(); + _projectile.position[0] = position[0]; + _projectile.position[1] = position[1]; + _projectile.shotByPlayer = shotByPlayer; + _projectile.positionGrid[position[0] - 1, position[1] - 5] = "|"; + _projectile.positionGrid[position[0] - 1, position[1] + 4] = "|"; + return _projectile; + } + public static Projectile MoveProjectie(Projectile _projectile) + { + if (_projectile.shotByPlayer) + { + _projectile.positionGrid[_projectile.position[0] - 1, _projectile.position[1] - 5] = null; + _projectile.positionGrid[_projectile.position[0] - 1, _projectile.position[1] + 4] = null; + if (_projectile.position[0] < 3 || _projectile.position[0] >= Render.yGridSize-2) + { + _projectile.isOutsideBounds = true; + } + else + { + _projectile.position[0] -= Projectile.speed; + _projectile.positionGrid[_projectile.position[0] - 1, _projectile.position[1] - 5] = "|"; + _projectile.positionGrid[_projectile.position[0] - 1, _projectile.position[1] + 4] = "|"; + + } + + } + else + { + _projectile.positionGrid[_projectile.position[0] - 1, _projectile.position[1] - 5] = null; + _projectile.positionGrid[_projectile.position[0] - 1, _projectile.position[1] + 4] = null; + if (_projectile.position[0] < 3 || _projectile.position[0] >= Render.yGridSize - 3) + { + _projectile.isOutsideBounds = true; + } + else + { + _projectile.position[0] += Projectile.speed; + _projectile.positionGrid[_projectile.position[0] - 1, _projectile.position[1] - 5] = "*"; + _projectile.positionGrid[_projectile.position[0] - 1, _projectile.position[1] + 4] = "*"; + + } + + } + return _projectile; + } + } +} diff --git a/Code/SpaceShooter/Render.cs b/Code/SpaceShooter/Render.cs new file mode 100644 index 0000000..87cf5b5 --- /dev/null +++ b/Code/SpaceShooter/Render.cs @@ -0,0 +1,247 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Input; +using CeedMain; + +namespace SpaceShooter +{ + class Render + { + private static StringBuilder sb = new StringBuilder(); + private static readonly Random _random = new Random(); + public static int xGridSize = 40; + public static int yGridSize = 30; + public string[,] renderGrid = new string[yGridSize, xGridSize]; + + + //Actual code lol + public static string[,] AddBackgroundStars(string[,] _renderGrid) + { + + int starAmnt = _random.Next(0, 500); + for (int i = 0; i < starAmnt; i++) + { + _renderGrid[_random.Next(0, yGridSize), _random.Next(0, xGridSize)] = ","; + } + return _renderGrid; + } + + public static string[,] AddPositionedElement(string[,] Model, int elementSizeX, int elementSizeY, int elementPosX, int elementPosY) + { + + string[,] renderGrid = new string[yGridSize, xGridSize]; + for (int i = 0; i < elementSizeY; i++) + { + for (int t = 0; t < elementSizeX; t++) + { + + int normalizedElementPosX = Math.Min(xGridSize-((int)Math.Ceiling((float)elementSizeX/2)), Math.Max(((int)Math.Ceiling((float)elementSizeY / 2)), elementPosX)); + int normalizedElementPosY = Math.Min(yGridSize - ((int)Math.Ceiling((float)elementSizeY / 2)), Math.Max(((int)Math.Ceiling((float)elementSizeY / 2)), elementPosY)); + /** + int normalizedElementPosX = Math.Min(xGridSize - elementSizeX / 2, Math.Max(elementSizeX / 2, elementPosX)); + int normalizedElementPosY = Math.Min(yGridSize - elementSizeY / 2, Math.Max(elementSizeY / 2, elementPosY)); + **/ + renderGrid[i + normalizedElementPosY - elementSizeY / 2, t + normalizedElementPosX- elementSizeX / 2] = Model[i, t]; + + } + + } + return renderGrid; + } + + public static void OutputFrame(PlayerShip _ship, string[,] renderGrid, List asteroidList,List projectileList, List pirateList) + { + //resets main renderLayer to 0 + for (int i = 0; i < Render.yGridSize; i++) + { + for (int t = 0; t < Render.xGridSize; t++) + { + renderGrid[i, t] = null; + } + } + //Adds all elements to the render frame buffer + string[,] renderGridBackground = AddBackgroundStars(renderGrid); + string[,] renderGridShip = AddPositionedElement(_ship.shipModel, 10, 4, _ship.shipPosX, _ship.shipPosY); + string[,] renderGridAsteroids = new string[yGridSize, xGridSize]; + string[,] renderGridProjectiles = new string[yGridSize, xGridSize]; + string[,] renderGridPirates = new string[yGridSize, xGridSize]; + + //Merges all asteroids into one layer + foreach (Asteroid a in asteroidList) + { + string[,] tempRenderGridAsteroids = AddPositionedElement(a.AsteroidModel, 7, 5, a.asteroidPosX, a.asteroidPosY); + for (int i = 0; i < Render.yGridSize; i++) + { + for (int t = 0; t < Render.xGridSize; t++) + { + if (renderGridAsteroids[i, t] == "" || renderGridAsteroids[i, t] == null) + { + renderGridAsteroids[i, t] = tempRenderGridAsteroids[i, t]; + } + } + } + } + + //Merges all projectiles into one layer + foreach (Projectile a in projectileList) + { + + for (int i = 0; i < Render.yGridSize; i++) + { + for (int t = 0; t < Render.xGridSize; t++) + { + if (renderGridProjectiles[i, t] == null || renderGridProjectiles[i, t] == "") + { + renderGridProjectiles[i, t] = a.positionGrid[i, t]; + } + } + } + } + + //Merges all pirates into one layer + foreach(Pirate a in pirateList) + { + string[,] tempRenderGridPirates = AddPositionedElement(a.shipModel, 10, 3, a.shipPosX, a.shipPosY); + for (int i = 0; i < Render.yGridSize; i++) + { + for (int t = 0; t < Render.xGridSize; t++) + { + if (renderGridPirates[i, t] == "" || renderGridPirates[i, t] == null) + { + renderGridPirates[i, t] = tempRenderGridPirates[i, t]; + } + } + } + } + + //Merges all layers into final renderGrid layer + for (int i = 0; i < Render.yGridSize; i++) + { + for (int t = 0; t < Render.xGridSize; t++) + { + if (renderGrid[i, t] == "" || renderGrid[i, t] == null || renderGrid[i, t] == ",") + { + if (renderGrid[i, t] == "" || renderGrid[i, t] == null || renderGrid[i, t] == ",") + { + renderGrid[i, t] = renderGridShip[i, t]; + } + } + } + } + for (int i = 0; i < Render.yGridSize; i++) + { + for (int t = 0; t < Render.xGridSize; t++) + { + if (renderGrid[i, t] == "" || renderGrid[i, t] == null || renderGrid[i, t] == ",") + { + renderGrid[i, t] = renderGridPirates[i, t]; + } + + } + } + for (int i = 0; i < Render.yGridSize; i++) + { + for (int t = 0; t < Render.xGridSize; t++) + { + if (renderGrid[i, t] == "" || renderGrid[i, t] == null) + { + + renderGrid[i, t] = renderGridProjectiles[i, t]; + + } + } + } + for (int i = 0; i < Render.yGridSize; i++) + { + for (int t = 0; t < Render.xGridSize; t++) + { + if (renderGrid[i, t] == "" || renderGrid[i, t] == null) + { + if (renderGrid[i, t] == "" || renderGrid[i, t] == null) + { + renderGrid[i, t] = renderGridAsteroids[i, t]; + } + } + } + } + for (int i = 0; i < Render.yGridSize; i++) + { + for (int t = 0; t < Render.xGridSize; t++) + { + if (renderGrid[i, t] == "" || renderGrid[i, t] == null) + { + renderGrid[i, t] = renderGridBackground[i, t]; + } + } + } + + //ADDS HUD INFO + + //hp + renderGrid[yGridSize - 2, xGridSize - 5] = "H"; + renderGrid[yGridSize - 2, xGridSize - 4] = "P"; + renderGrid[yGridSize - 2, xGridSize - 3] = ":"; + renderGrid[yGridSize - 2, xGridSize - 2] = _ship.shipHealth.ToString(); + + //_ship.killedPirateAmnt + renderGrid[yGridSize - 1, xGridSize - 8] = "K"; + renderGrid[yGridSize - 1, xGridSize - 7] = "I"; + renderGrid[yGridSize - 1, xGridSize - 6] = "L"; + renderGrid[yGridSize - 1, xGridSize - 5] = "L"; + renderGrid[yGridSize - 1, xGridSize - 4] = "S"; + renderGrid[yGridSize - 1, xGridSize - 3] = ":"; + renderGrid[yGridSize - 1, xGridSize - 2] = Convert.ToString(_ship.killedPirateAmnt); + + + //replaces all nulls with spaces + for (int i = 0; i < yGridSize; i++) + { + for (int t = 0; t < xGridSize; t++) + { + if (renderGrid[i, t] == "" || renderGrid[i, t] == null) + { + renderGrid[i, t] = " "; + } + } + } + + //Sets the window to be the size the game needs & centers position + Console.SetWindowSize(xGridSize+3, yGridSize+4); + + //Sets up console + sb.Clear(); + Console.SetCursorPosition(0, 0); + Console.CursorVisible = false; + + //Renders with frame to Console + sb.AppendLine(""); + for(int i = 0; i < xGridSize;i++) + { + sb.Append("_"); + } + + for (int i = 0; i < yGridSize; i++) + { + sb.Append("|"); + for (int t = 0; t < xGridSize; t++) + { + sb.Append(renderGrid[i, t]); + } + sb.AppendLine("|"); + } + + sb.AppendLine(""); + for (int i = 0; i < xGridSize; i++) + { + sb.Append("_"); + } + Console.WriteLine(sb); + + } + } +} diff --git a/Code/SpaceShooter/SpaceShooterMain.cs b/Code/SpaceShooter/SpaceShooterMain.cs new file mode 100644 index 0000000..f7bdd84 --- /dev/null +++ b/Code/SpaceShooter/SpaceShooterMain.cs @@ -0,0 +1,204 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Input; +using CeedMain; + +namespace SpaceShooter +{ + class MainProgram + { + private static int pirateShipByHostilityAmount = 0; + private readonly static Random _random = new Random(); + public static PlayerShip ShooterMain(PlayerShip _playerShip, SolarSystem _solarSystem, int planetIndex) + { + //initialise console + Console.OutputEncoding = System.Text.Encoding.UTF8; + Render _render = new Render(); + Console.Clear(); + + //setup + Asteroid _asteroids = new Asteroid(); + List projectileList = new List(); + List asteroidList = new List(); + List pirateList = new List(); + _playerShip.killedPirateAmnt = 0; + + //set graphic + _playerShip.shipModel = PlayerShip.SetShipModel(); + //THREAD THAT MANAGES INPUT + new Thread(() => + { + while (true) + { + Thread.CurrentThread.IsBackground = true; + _playerShip = GameLogic.Controller(_playerShip); + } + }).Start(); + + while (true) + { + + //DOES PIRATE STUFF + //makes sure hostility num = amount of pirate ships + if (pirateList.Count <= _solarSystem.planetsList[planetIndex].hostility) + { + + int pirateAmnt = _random.Next(0, 15); + if (pirateAmnt == 4) + { + Pirate tempPirate = new Pirate + { + shipPosX = _random.Next(6, 26), + shipModel = Pirate.SetShipModel() + }; + pirateList.Add(tempPirate); + } + } + for (int i = 0; i < pirateList.Count; i++) + { + pirateList[i] = GameLogic.PirateLogic(pirateList[i], _playerShip); + if (pirateList[i].isOutsideBounds) + { + pirateList.Remove(pirateList[i]); + } + } + + + //IF ASTEROIDS IN SYSTEM, PREPARES ASTEROIDS EACH FRAME + + if(_solarSystem.hasAsteroids) + { + + int asteroidAmnt = _random.Next(0, 20); + if(asteroidAmnt == 3) + { + for (int i = 0; i < asteroidAmnt; i++) + { + Asteroid tempAsteroid = new Asteroid(); + tempAsteroid = GameLogic.AsteroidGenerator(); + asteroidList.Add(tempAsteroid); + } + } + + //move asteroids + for (int i = 0; i < asteroidList.Count; i++) + { + asteroidList[i] = GameLogic.MoveAsteroid(asteroidList[i]); + if (asteroidList[i].asteroidPosY > Render.yGridSize) + { + asteroidList.Remove(asteroidList[i]); + } + } + } + //HANDLE PROJECTILES + + //pirate + for (int i = 0; i < pirateList.Count; i++) + { + if (pirateList[i].isFiring) + { + int[] pos = { pirateList[i].shipPosY, pirateList[i].shipPosX }; + Projectile _projectile = Projectile.CreateProjectile(pos, false); + projectileList.Add(_projectile); + pirateList[i].isFiring = false; + } + + } + + //player + if (_playerShip.isFiring) + { + int[] pos = { _playerShip.shipPosY, _playerShip.shipPosX }; + Projectile _projectile = Projectile.CreateProjectile(pos, true); + projectileList.Add(_projectile); + _playerShip.isFiring = false; + } + if (projectileList.Count > 0) + { + for (int i = 0; i < projectileList.Count; i++) + { + if (projectileList[i].isOutsideBounds) + { + projectileList.Remove(projectileList[i]); + } + else + { + projectileList[i] = Projectile.MoveProjectie(projectileList[i]); + } + } + } + + + //COLLISION STUFF + int[] collisionDataShipProjectile = GameLogic.CollisionShipProjectile(_playerShip, projectileList); + if(collisionDataShipProjectile[1] > 0) + { + _playerShip.shipHealth -= collisionDataShipProjectile[1]; + projectileList.RemoveAt(collisionDataShipProjectile[0]); + + } + + int[] collisionDataShipAsteroid = GameLogic.CollisionShipAsteroid(_playerShip, asteroidList); + if (collisionDataShipAsteroid[1] > 0) + { + _playerShip.shipHealth -= collisionDataShipAsteroid[1]; + _playerShip.totalDestroyedAsteroids += 1; + asteroidList.RemoveAt(collisionDataShipAsteroid[0]); + + } + + int[] collisionDataShipPirate = GameLogic.CollisionShipPirate(_playerShip, pirateList); + if (collisionDataShipPirate[1] > 0) + { + _playerShip.shipHealth -= collisionDataShipPirate[1]; + pirateList.RemoveAt(collisionDataShipPirate[0]); + _playerShip.totalKilledPirateAmnt += 1; + _playerShip.killedPirateAmnt += 1; + _playerShip.Money += 1; + + } + + int[] collisionDataPirateProjectile = GameLogic.CollisionPirateProjectile(projectileList, pirateList); + if (collisionDataPirateProjectile[1] > 0) + { + pirateList[collisionDataPirateProjectile[2]].health -= collisionDataPirateProjectile[1]; + if(pirateList[collisionDataPirateProjectile[2]].health <= 0) + { + _playerShip.Money += 1; + _playerShip.killedPirateAmnt += 1; + _playerShip.totalKilledPirateAmnt += 1; + pirateList.RemoveAt(collisionDataPirateProjectile[2]); + } + projectileList.RemoveAt(collisionDataPirateProjectile[0]); + } + + int[] collisionDataAsteroidProjectile = GameLogic.CollisionAsteroidProjectile(projectileList, asteroidList); + if (collisionDataAsteroidProjectile[1] > 0) + { + asteroidList.RemoveAt(collisionDataAsteroidProjectile[2]); + projectileList.RemoveAt(collisionDataPirateProjectile[0]); + _playerShip.totalDestroyedAsteroids += 1; + _playerShip.Money += 1; + } + if (_playerShip.shipHealth <= 0) + { + return _playerShip; + } + if (_playerShip.killedPirateAmnt >= (_solarSystem.planetsList[planetIndex].hostility* _solarSystem.planetsList[planetIndex].hostility) +1) + { + return _playerShip; + } + + //RENDER IT OUT + Render.OutputFrame(_playerShip, _render.renderGrid, asteroidList, projectileList, pirateList); + Thread.Sleep(70); + Console.Clear(); + } + } + } +}