public void Setup() { _world = new World(800, 600, 1f) { GameSpeed = 2f }; _world.LoadLevel(new LevelWithFourBricks()); _ballsModel = new BallsModel(_world, BoxLength, BoxLength, new Vector2(0f, 0f), new Vector2(0f, 0f)); }
public FrameModel(World world) : base(world) { Rectangle viewport = world.GetViewport(); _topWall = new Rectangle(viewport.Left + WallWidth, viewport.Top, viewport.Width - (WallWidth * 2), WallWidth); _leftWall = new Rectangle(viewport.Left, viewport.Top, WallWidth, viewport.Height); _rightWall = new Rectangle(viewport.Right - WallWidth, viewport.Top, WallWidth, viewport.Height); }
public PlayerModel(World world, float scale) : base(world) { _world = world; _width = 120; _height = 20; var viewport = world.GetViewport(); _ship = new Rectangle(viewport.Center.X, (viewport.Bottom - viewport.Height / 8), (int)(_width * scale), (int)(_height * scale)); }
public void HandleCollisionWithAnyGameObject(World world) { var ballRectangle = new Rectangle((int)Position.X, (int)Position.Y, Width, Height); var frame = world.GetFrameModel(); HandleFrameAndBallCollision(ballRectangle, frame); var player = world.GetPlayerModel(); HandlePlayerAndBallCollision(ballRectangle, player); _brickCollisionHandler.HandleBrickAndBallCollisions(ballRectangle, world.CurrentLevel.GetBricks()); }
public BallsModel(World world, int width, int height, Vector2 startPosition, Vector2 startDirection) : base(world) { _world = world; _width = width; _height = height; _startPosition = startPosition; _startDirection = startDirection; _balls = new List<Ball>(); Add(new Ball(_width, _height, _startPosition, _startDirection)); }
public void SetUp() { _world = new World(800, 600, 1f) { GameSpeed = 1f }; }
public WorldViewer(World world, SpriteFont infoFont) { _world = world; _infoFont = infoFont; }
public LevelViewer(World world, Texture2D yellowSquareTexture) { _world = world; _yellowSquareTexture = yellowSquareTexture; }
public void Setup() { _world = new World(800, 600, 1f) { GameSpeed = 1f }; _playerModel = new PlayerModel(_world, 1f); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. _spriteBatch = new SpriteBatch(GraphicsDevice); _world = new World(_graphics.GraphicsDevice.Viewport.Width, _graphics.GraphicsDevice.Viewport.Height); BallsModel ballsModel = _world.GetBallsModel(); _ballTexture = Content.Load<Texture2D>("Sprites\\SilverBall"); _ballsViewer = new BallsViewer(ballsModel.GetAllBalls(), _ballTexture); _frameTexture = Content.Load<Texture2D>("Frame\\titanium"); _frameViewer = new FrameViewer(_world.GetFrameModel(), _frameTexture); var infoFont = Content.Load<SpriteFont>("Fonts\\InfoFont"); _worldViewer = new WorldViewer(_world, infoFont); _playerTexture = Content.Load<Texture2D>("Sprites\\PlayerShip"); PlayerModel playerModel = _world.GetPlayerModel(); _playerController = new PlayerController(playerModel); _playerViewer = new PlayerViewer(playerModel, _playerTexture); _yellowSquareTexture = Content.Load<Texture2D>("Sprites\\yellowsquare"); _levelViewer = new LevelViewer(_world, _yellowSquareTexture); }
public void Setup() { _world = new World(800, 600, 1f) { GameSpeed = 1f }; _ballsModel = new BallsModel(_world, BoxLength, BoxLength, new Vector2(0f, 0f), new Vector2(0f, 0f)); }