コード例 #1
0
        public void Reset()
        {
            uneBall   = new Ball(textureBall, new Vector2(((GameZone.Right) / 2) - (ballSize / 2), uneRacket.Pos.Y - ballSize), ballSize, ballSize);
            uneRacket = new Racket(textureRacket, new Vector2(((GameZone.Right) / 2) - (racketWidth / 2), 550), racketWidth, racketHeight);

            isRunning = false;
            mesBricks = new List <Brick>();
            mesBricks = GenerateMap(mapInt);
        }
コード例 #2
0
        public override void Load()
        {
            mapInt = new int[, ] { //int[20,15]
                { 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 4, 1, 4, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 4, 1, 4, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 4, 1, 1, 1, 4, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 4, 1, 1, 1, 4, 0, 0, 0, 0, 0 },
                { 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 4, 4, 4, 4, 4 },
                { 0, 4, 1, 1, 1, 1, 4, 1, 4, 1, 1, 1, 1, 4, 0 },
                { 0, 0, 4, 1, 1, 1, 4, 1, 4, 1, 1, 1, 4, 0, 0 },
                { 0, 0, 0, 4, 1, 1, 1, 1, 1, 1, 1, 4, 0, 0, 0 },
                { 0, 0, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 0, 0 },
                { 0, 0, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 0, 0 },
                { 0, 4, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 4, 0 },
                { 0, 4, 1, 1, 1, 4, 4, 0, 4, 4, 1, 1, 1, 4, 0 },
                { 4, 1, 1, 4, 4, 0, 0, 0, 0, 0, 4, 4, 1, 1, 4 },
                { 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4 },
                { 0, 5, 5, 5, 5, 5, 0, 0, 0, 5, 5, 5, 5, 5, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
            };

            mainGame.IsMouseVisible = false;
            isRunning = false;

            GameZone   = new Rectangle(25, 25, 495, 555);
            background = mainGame.Content.Load <Texture2D>("backgroundGame");

            racketWidth   = 85;
            racketHeight  = 15;
            textureRacket = mainGame.Content.Load <Texture2D>("racket");
            //uneRacket = new Racket(racketWidth, racketHeight, new Vector2(((GameZone.Right) / 2) - (racketWidth / 2), 550), 1, Graphic);
            uneRacket = new Racket(textureRacket, new Vector2(((GameZone.Right) / 2) - (racketWidth / 2), 550), racketWidth, racketHeight);

            textureBall = mainGame.Content.Load <Texture2D>("ball");
            ballSize    = 12;
            //uneBall = new Ball(ballSize, ballSize, new Vector2(((GameZone.Right) / 2) - (ballSize / 2), uneRacket.Pos.Y - ballSize), 1, Graphic);
            uneBall = new Ball(textureBall, new Vector2(((GameZone.Right) / 2) - (ballSize / 2), uneRacket.Pos.Y - ballSize), ballSize, ballSize);

            mesBricks   = new List <Brick>();
            tilesBrick  = mainGame.Content.Load <Texture2D>("bricks");
            BrickWidth  = 33;
            BrickHeight = 17;
            mesBricks   = GenerateMap(mapInt);


            oldKbState = Keyboard.GetState();
            base.Load();
        }