aboutsummaryrefslogtreecommitdiff
path: root/Space Invaders/Program.cs
blob: bf9751dcefb79bc766a15d571b41dead32ae0329 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GameEngine;

namespace SpaceInvaders {

    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
        }

    }

}