public BreakoutPaddle(Game game, string spriteName, PlayerController controller, BreakoutBall ball, float speed = 0f, float acceleration = 0f, float friction = 0f)
     : base(game, spriteName, controller, speed, acceleration, friction)
 {
     this.lockedY = true;
     this.ball = ball;
     this.disabled = false;
 }
示例#2
0
        public void Spawn()
        {
            Vector2 paddleStartPos = new Vector2(Game.GraphicsDevice.Viewport.Width / 2f, Game.GraphicsDevice.Viewport.Height - 20);

            this.ball = new BreakoutBall(Game, "Sprites/Ball/ballSmall", new BallController(Game), 220f);
            PlayerController paddleController = new PlayerController(Game, 0);
            this.paddle = new BreakoutPaddle(Game, "Sprites/Player/paddleBig", paddleController, ball, 270f, 0f, 0f);

            upperSpawner = new BlockRegion(Game, new Rectangle(20, 20 + HUDHeight, Game.GraphicsDevice.Viewport.Width - 40, 200), Game.GraphicsDevice);
            lowerSpawner = new BlockRegion(Game, new Rectangle(20, 120 + HUDHeight, Game.GraphicsDevice.Viewport.Width - 40, 200), Game.GraphicsDevice);

            Game.Components.Add(paddleController);
            Game.Components.Add(paddle);
            Game.Components.Add(ball);
            Game.Components.Add(upperSpawner);
            Game.Components.Add(lowerSpawner);

            this.paddle.Transform.position = paddleStartPos;

            LevelOne();
        }