Exemple #1
0
        private void levelOneConfigure()
        {
            Point userSpot = new Point(500, 500);

            userTank        = new UserTank(TANK_TYPE.LIGHT, SPEED_LEVEL.HIGHT, userSpot);
            isUserTankAlive = true;
            Controls.Add(userTank);
            userTank.Show();

            Point compSpot       = new Point(500, 50);
            int   spotDifference = -200;
            int   countOfEnemies = 5;

            for (int i = 0; i < countOfEnemies; i++)
            {
                CompTank compTank = new CompTank(TANK_TYPE.LIGHT, SPEED_LEVEL.HIGHT, new Point(compSpot.X + spotDifference, compSpot.Y));
                compTanks.Add(compTank);
                Controls.Add(compTank);
                compTank.Show();

                spotDifference += 100;
            }

            userTank.Focus();
            bulletsMoveWorker.Start();
            resultGameChecker.Start();
            compTanksActionWorker.Start();
        }
Exemple #2
0
        private void LevelOneConfigure()
        {
            GameStatus    = GAME_STATUS.GAME_STARTED;
            gunLabel.Text = "Gun: Ready";

            var baseLocation = new Point(gameFieldLocationX + gameFieldWidth / 2, gameFieldLocationY + gameFieldHeight - baseHeight);

            userBase = new UserBase(baseLocation);
            Controls.Add(userBase);
            userBase.Show();

            userTank        = new UserTank(TANK_TYPE.LIGHT, SPEED_LEVEL.HIGHT, new Point(baseLocation.X, baseLocation.Y - tankHeight - 30));
            isUserTankAlive = true;
            Controls.Add(userTank);
            userTank.Show();

            // Computer tanks
            var compSpot = new Point(gameFieldLocationX, gameFieldLocationY);
            var compTank = new CompTank(TANK_TYPE.LIGHT, SPEED_LEVEL.HIGHT, compSpot);

            compTank.SetStrategy(new DummyStrategy());
            compTanks.Add(compTank);
            Controls.Add(compTank);
            compTank.Show();

            compSpot = new Point(gameFieldLocationX + 100, gameFieldLocationY);
            compTank = new CompTank(TANK_TYPE.LIGHT, SPEED_LEVEL.HIGHT, compSpot);
            compTank.SetStrategy(new UserKillStrategy(compTank, userTank));
            compTanks.Add(compTank);
            Controls.Add(compTank);
            compTank.Show();

            compSpot = new Point(gameFieldLocationX + 200, gameFieldLocationY);
            compTank = new CompTank(TANK_TYPE.LIGHT, SPEED_LEVEL.HIGHT, compSpot);
            compTank.SetStrategy(new DummyStrategy());
            compTanks.Add(compTank);
            Controls.Add(compTank);
            compTank.Show();

            compSpot = new Point(gameFieldLocationX + 300, gameFieldLocationY);
            compTank = new CompTank(TANK_TYPE.LIGHT, SPEED_LEVEL.HIGHT, compSpot);
            compTank.SetStrategy(new UserKillStrategy(compTank, userTank));
            compTanks.Add(compTank);
            Controls.Add(compTank);
            compTank.Show();

            compSpot = new Point(gameFieldLocationX + 400, gameFieldLocationY);
            compTank = new CompTank(TANK_TYPE.LIGHT, SPEED_LEVEL.HIGHT, compSpot);
            compTank.SetStrategy(new BaseKillStrategy(compTank, userBase));
            compTanks.Add(compTank);
            Controls.Add(compTank);
            compTank.Show();

            // Walls around base
            DrawBaseWalls(baseLocation, WALL_TYPE.LIGHT);

            userTank.Focus();
            bulletsMoveWorker.Start();
            resultGameChecker.Start();
            compTanksActionWorker.Start();
        }