public List <Enemy> enemies = new List <Enemy>(); //Enemy List public Game() { ShowTitle(); Console.Clear(); new Instruction(); Console.OutputEncoding = System.Text.Encoding.Unicode; //instantiate the engine variables _input = new InputListener(); _renderer = new Renderer(this); _player = new Player(new Vector3(6, 6), _input, this); _ui = new UI(_player, this); //create the level LoadLevel(); //create the games entities AddEnemy(new Archer(new Vector3(15, 8), this, 1)); AddEnemy(new Archer(new Vector3(15, 4), this, 3)); AddEnemy(new Soldier(new Vector3(12, 15), this, 3)); AddEnemy(new Boss(new Vector3(25, 25), this, 3)); AddEnemy(new Soldier(new Vector3(12, 20), this, 3)); //create pickups AddProjectile(new Key(new Vector3(14, 15), "key")); AddProjectile(new HealthPickup(new Vector3(14, 8), "health")); //the games running loop while (isRunning) { _input.Update(); //input update Update(); //game update _renderer.Render(); //render update System.Threading.Thread.Sleep(50); //make the program sleep for 50 milliseconds } }
//Player's position // Vector3 playerPos = new Vector3(12, 10); //Player class constructor where we receive the input listener and the game class reference. public Player(Vector3 _pos, InputListener il, Game g) { pos = _pos; _input = il; _game = g; }