Example #1
0
        protected void handleKeyboard()
        {
            KeyboardState keyState = Keyboard.GetState();

            if (keyState.IsKeyDown(Keys.Escape) && !oldState.IsKeyDown(Keys.Escape))
            {
                this.Exit();
            }
            if (keyState.IsKeyDown(Keys.Left))
            {
                board.changeAngle(-1);
            }
            if (keyState.IsKeyDown(Keys.Right))
            {
                board.changeAngle(1);
            }
            if (keyState.IsKeyDown(Keys.Up) && !oldState.IsKeyDown(Keys.Up))
            {
                board.shoot();
            }

            if (keyState.IsKeyDown(Keys.A))
            {
                CameraHolder.cameraFar.RotateY(Angle.toRadians(5));
            }
            if (keyState.IsKeyDown(Keys.S))
            {
                CameraHolder.cameraFar.MoveForwards(-2);
            }
            if (keyState.IsKeyDown(Keys.D))
            {
                CameraHolder.cameraFar.RotateY(Angle.toRadians(-5));
            }
            if (keyState.IsKeyDown(Keys.W))
            {
                CameraHolder.cameraFar.MoveForwards(2);
            }
            if (keyState.IsKeyDown(Keys.Q))
            {
                BubbleHolder.initGrid(0, 0, 0);
            }
            if (keyState.IsKeyDown(Keys.C) && !oldState.IsKeyDown(Keys.C))
            {
                isFp = !isFp;
                CameraHolder.switchCameras(isFp);
            }

            if (keyState.IsKeyDown(Keys.Enter) && !oldState.IsKeyDown(Keys.Enter))
            {
                proceed();
            }
            if (keyState.IsKeyDown(Keys.R) && !oldState.IsKeyDown(Keys.R))
            {
                changeLevel(CurrentLevel);
            }
            oldState = keyState;
        }
Example #2
0
        public override void Initialize()
        {
            BubbleHolder.initGrid(boardPosition.x, boardPosition.y, boardPosition.z);
            if (currentLevel == 2)
            {
                /*
                 * for (int j = 0; j < 4; j++)
                 * {
                 * for (int i = 0; i < 8; i++)
                 * {
                 *  BubbleHolder.grid[i, j].bubble = BubbleCreator.createRandomBubble(BubbleHolder.grid[i, j].point);
                 *  childComponents.Add(BubbleHolder.grid[i, j].bubble);
                 * }
                 * }
                 * */
                createLevel2();
            }
            else
            {
                /*
                 * int[] coordinates = new int[]{ 0, 0 };
                 * BubbleHolder.grid[coordinates[0], coordinates[1]].bubble = new Bubble(Game, BubbleColor.red, BubbleHolder.grid[coordinates[0], coordinates[1]].point);
                 * childComponents.Add(BubbleHolder.grid[coordinates[0], coordinates[1]].bubble);
                 *
                 * coordinates = new int[] { 0, 1 };
                 * BubbleHolder.grid[coordinates[0], coordinates[1]].bubble = new Bubble(Game, BubbleColor.red, BubbleHolder.grid[coordinates[0], coordinates[1]].point);
                 * childComponents.Add(BubbleHolder.grid[coordinates[0], coordinates[1]].bubble);
                 *
                 * coordinates = new int[] { 0, 2 };
                 * BubbleHolder.grid[coordinates[0], coordinates[1]].bubble = new Bubble(Game, BubbleColor.red, BubbleHolder.grid[coordinates[0], coordinates[1]].point);
                 * childComponents.Add(BubbleHolder.grid[coordinates[0], coordinates[1]].bubble);
                 * */
                createLevel1();
            }

            WallBlock w1 = new WallBlock(new Point(verteces[0], verteces[2], verteces[5]), new Point(verteces[0], verteces[3] + 3, verteces[4]));

            walls.Add(w1);

            //WallBlock w2 = new WallBlock(new Point(verteces[0], verteces[2], verteces[5]), new Point(verteces[1] + 2, verteces[2], verteces[5]));
            //walls.Add(w2);

            WallBlock w3 = new WallBlock(new Point(verteces[1], verteces[2], verteces[5]), new Point(verteces[1], verteces[3] + 3, verteces[4]));

            walls.Add(w3);

            WallBlock w4 = new WallBlock(new Point(verteces[0] + 2, verteces[3], verteces[4]), new Point(verteces[1] + 2, verteces[3], verteces[4]));

            walls.Add(w4);

            WallBlock w5 = new WallBlock(new Point(verteces[0], verteces[2], verteces[5] - Wall.size.depth), new Point(verteces[0], verteces[3] + 3, verteces[4] - Wall.size.depth));

            walls.Add(w5);

            //WallBlock w2 = new WallBlock(new Point(verteces[0], verteces[2], verteces[5]), new Point(verteces[1] + 2, verteces[2], verteces[5]));
            //walls.Add(w2);

            WallBlock w6 = new WallBlock(new Point(verteces[1], verteces[2], verteces[5] - Wall.size.depth), new Point(verteces[1], verteces[3] + 3, verteces[4] - Wall.size.depth));

            walls.Add(w6);

            WallBlock w7 = new WallBlock(new Point(verteces[0] + 2, verteces[3], verteces[4] - Wall.size.depth), new Point(verteces[1] + 2, verteces[3], verteces[4] - Wall.size.depth));

            walls.Add(w7);

            WallBlock w8 = new WallBlock(new Point(verteces[0], verteces[2], verteces[5] - 2 * Wall.size.depth), new Point(verteces[0], verteces[3] + 3, verteces[4] - 2 * Wall.size.depth));

            walls.Add(w8);

            //WallBlock w2 = new WallBlock(new Point(verteces[0], verteces[2], verteces[5]), new Point(verteces[1] + 2, verteces[2], verteces[5]));
            //walls.Add(w2);

            WallBlock w9 = new WallBlock(new Point(verteces[1], verteces[2], verteces[5] - 2 * Wall.size.depth), new Point(verteces[1], verteces[3] + 3, verteces[4] - 2 * Wall.size.depth));

            walls.Add(w9);

            WallBlock w10 = new WallBlock(new Point(verteces[0] + 2, verteces[3], verteces[4] - 2 * Wall.size.depth), new Point(verteces[1] + 2, verteces[3], verteces[4] - 2 * Wall.size.depth));

            walls.Add(w10);

            background = new WallArea(new Point(verteces[0] + 2, verteces[2], verteces[5] - 5), new Point(verteces[1], verteces[3] + 4, verteces[4] - 5));


            base.Initialize();
        }