コード例 #1
0
ファイル: Bricks.cs プロジェクト: KaoticKibz/Brick-Breaker
 public void CheckCollision(Ball ball)
 {
     if (alive && ball.Bounds.Intersects(location))
     {
         alive = false;
         ball.Deflection(this);
     }
 }
コード例 #2
0
ファイル: Game1.cs プロジェクト: KaoticKibz/Brick-Breaker
        /// <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);

            Texture2D tempTexture = Content.Load<Texture2D>("paddle");
            paddle = new Paddle(tempTexture, screenRectangle);

            tempTexture = Content.Load<Texture2D>("ball");
            ball = new Ball(tempTexture, screenRectangle);

            brickImage = Content.Load<Texture2D>("brick");

            StartGame();
        }