diff options
Diffstat (limited to 'Space Invaders/Program.cs')
-rw-r--r-- | Space Invaders/Program.cs | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/Space Invaders/Program.cs b/Space Invaders/Program.cs index 49244b1..bf9751d 100644 --- a/Space Invaders/Program.cs +++ b/Space Invaders/Program.cs @@ -3,10 +3,58 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using GameEngine; + +namespace SpaceInvaders { -namespace Space_Invaders { class Program { static void Main(string[] args) { + Game SpaceInvaders = new SpaceInvaders(); + SpaceInvaders.Setup(); + SpaceInvaders.Start(); } } + + class SpaceInvaders : Game { + + public override void Setup() { + // This sub is meant for setting the properties of the GameEngine. DO NOT MAKE NEW ONES HERE + // IMPORTANT! You might have to change the console font size, depending on how many rows and columns you want to have! + ConsoleWidth = 600; // Bigger than 15 + ConsoleHeight = 120; // Bigger than 15 + } + + public override void Start() { + // Initialize all gameobjects here + GameObject gameLogic = new GameLogic(); + gameLogic.Parent = this; + GameObjects.Add(gameLogic); + + // Initialize the player + GameObject player = new Player(); + player.Parent = this; + player.xPos = ConsoleWidth / 2 - 10; + player.yPos = 115; + player.Scale = 1; + GameObjects.Add(player); + + // Init a monster + GameObject monster1 = new Monster(); + GameObjects.Add(monster1); + + // Init Obstacles + + for (int i = 0; i < 6; i++) { + GameObject obstacle = new Obstacle(); + player.Parent = this; + obstacle.xPos = 50 + (i * 90); + obstacle.yPos = 90; + GameObjects.Add(obstacle); + } + + base.Start(); // Do start from inherited class, Required for the engine to actually start + } + + } + } |