protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); startGameSplash = Content.Load <Texture2D>("start-splash"); background = Content.Load <Texture2D>("background"); gameOverTexture = Content.Load <Texture2D>("game-over"); howtoTexture = Content.Load <Texture2D>("howto"); creditsTexture = Content.Load <Texture2D>("creds"); logoTexture = Content.Load <Texture2D>("flappyeric"); soundEffects.Add(Content.Load <SoundEffect>("shutdown")); ericBird = new SpriteClass(GraphicsDevice, "Content/ericgif.gif", ScaleToHighDPI(0.3f)); pipeTop = new SpriteClass(GraphicsDevice, "Content/pipedown.png", ScaleToHighDPI(1f)); pipeBottom = new SpriteClass(GraphicsDevice, "Content/pipeup.png", ScaleToHighDPI(1f)); pipeTop2 = new SpriteClass(GraphicsDevice, "Content/pipedown.png", ScaleToHighDPI(1f)); pipeBottom2 = new SpriteClass(GraphicsDevice, "Content/pipeup.png", ScaleToHighDPI(1f)); scoreFont = Content.Load <SpriteFont>("Score"); stateFont = Content.Load <SpriteFont>("GameState"); credsFont = Content.Load <SpriteFont>("Credits"); }
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); }