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; }
private void HandleFrameAndBallCollision(Rectangle ballRectangle, FrameModel frame) { if (frame.IntersectsWithTopWall(ballRectangle)) { ChangeVelocityToDown(); } if (frame.IntersectsWithLeftWall(ballRectangle)) { ChangeVelocityToRight(); } if (frame.IntersectsWithRightWall(ballRectangle)) { ChangeVelocityToLeft(); } }
public FrameViewer(FrameModel frameModel, Texture2D frameTexture) { _frameModel = frameModel; _frameTexture = frameTexture; }