Ejemplo n.º 1
0
        public World(int viewportWidth, int viewportHeight, float scale)
        {
            _boxLength *= scale;
            _startPositionForNewBall = new Vector2(viewportWidth / 2f, (viewportHeight/3f) * 2f);

            _viewportRect = new Rectangle(0, 0,
                viewportWidth,
                viewportHeight);
            _ballsModel = new BallsModel(this, (int)_boxLength, (int)_boxLength, _startPositionForNewBall, _startDirectionForNewBall);
            _frameModel = new FrameModel(this);
            _playerModel = new PlayerModel(this, scale);
            CurrentLevel = LoadLevel(1, scale);
            CurrentState = GameState.Normal;
        }
Ejemplo n.º 2
0
        private void HandleFrameAndBallCollision(Rectangle ballRectangle, FrameModel frame)
        {
            if (frame.IntersectsWithTopWall(ballRectangle))
            {
                ChangeVelocityToDown();
            }
            if (frame.IntersectsWithLeftWall(ballRectangle))
            {
                ChangeVelocityToRight();
            }

            if (frame.IntersectsWithRightWall(ballRectangle))
            {
                ChangeVelocityToLeft();
            }
        }
Ejemplo n.º 3
0
 public FrameViewer(FrameModel frameModel, Texture2D frameTexture)
 {
     _frameModel = frameModel;
     _frameTexture = frameTexture;
 }