Example #1
0
        public void TestHandleCollisionPlayerEnemy()
        {
            var game = new Game();
            var player = new Player(new Point(1, 1), game);
            var enemy = new Enemy(new Point(1, 1), game);

            bool expected = true;

            player.HandleCollision(enemy);

            var actual = player.IsDie;

            Assert.AreEqual(expected, actual);
        }
Example #2
0
        public void TestHandleCollisionPlayerWall()
        {
            var game = new Game();
            var player = new Player(new Point(1, 0), game);
            var wall = new BrickWall(new Point(1, 0), game);

            var expected = player.PrevPosition;

            player.HandleCollision(wall);

            var actual = player.Position;

            Assert.AreEqual(expected, actual);
        }
Example #3
0
        public static void Main()
        {
            var game = new Game();
            Drawing.Game = game;
            game.Load("..\\..\\map.cs");

            // Q (quit)
            while (!game.IsGameOver && GetAsyncKeyState(0x51) == 0 )
            {
                game.ProcessObjects();
                Drawing.DrawField();
                Drawing.ShowField();
                Console.SetCursorPosition(0, 0);
            }

            Console.WriteLine("Game over!");
            Console.ReadLine();
        }
Example #4
0
 public GameObject(Point pos, Game g)
 {
     Position = pos;
     Game = g;
 }
Example #5
0
 public Door(Point pos, Game g)
     : base(pos, g)
 {
 }
Example #6
0
 public Explosion(Point pos, Game g, int t)
     : base(pos, g)
 {
     timer = t;
 }
Example #7
0
 public Walker(Point pos, Game g)
     : base(pos, g)
 {
 }
Example #8
0
 public Enemy(Point pos, Game g)
     : base(pos, g)
 {
 }
Example #9
0
 public MetallWall(Point pos, Game g)
     : base(pos, g)
 {
 }
Example #10
0
 public BrickWall(Point pos, Game g)
     : base(pos, g)
 {
 }
Example #11
0
 public Bomb(Point pos, Game g, int t)
     : base(pos, g)
 {
     timer = t;
 }
Example #12
0
 public Player(Point pos, Game g)
     : base(pos, g)
 {
 }