예제 #1
0
파일: Game1.cs 프로젝트: hmadland/460
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            grass       = Content.Load <Texture2D>("grass");
            texture     = this.Content.Load <Texture2D>("tinyWalk");
            texture2    = this.Content.Load <Texture2D>("fire");

            avatar = new spriteClass(texture, 1f);
            fire   = new spriteClass(texture2, 0.2f);

            startGameSplash = Content.Load <Texture2D>("start-splash");
            scoreFont       = Content.Load <SpriteFont>("Score");
            stateFont       = Content.Load <SpriteFont>("GameState");

            gameOverTexture = Content.Load <Texture2D>("brown");
        }
예제 #2
0
파일: spriteClass.cs 프로젝트: hmadland/460
 public bool RectangleCollision(spriteClass otherSprite)
 {
     if (this.x + this.texture.Width * this.scale * HITBOXSCALE / 2 < otherSprite.x - otherSprite.texture.Width * otherSprite.scale / 2)
     {
         return(false);
     }
     if (this.y + this.texture.Height * this.scale * HITBOXSCALE / 2 < otherSprite.y - otherSprite.texture.Height * otherSprite.scale / 2)
     {
         return(false);
     }
     if (this.x - this.texture.Width * this.scale * HITBOXSCALE / 2 > otherSprite.x + otherSprite.texture.Width * otherSprite.scale / 2)
     {
         return(false);
     }
     if (this.y - this.texture.Height * this.scale * HITBOXSCALE / 2 > otherSprite.y + otherSprite.texture.Height * otherSprite.scale / 2)
     {
         return(false);
     }
     return(true);
 }