public override void Draw(SpriteBatch spriteBatch) { mBackground.Draw(spriteBatch); foreach (Goomba aGoomba in mGoombas) { aGoomba.Draw(spriteBatch); } foreach (MysteryBlock aMysteryBlock in mMysteryBlocks) { aMysteryBlock.Draw(spriteBatch); } foreach (Pipe aPipe in mPipes) { aPipe.Draw(spriteBatch); } mPlayer.Draw(spriteBatch); }
/// <summary> /// Tekent alle objecten op het scherm /// </summary> /// <param name="theSpriteBatch"></param> public override void Draw(SpriteBatch theSpriteBatch) { background.Draw(theSpriteBatch); castle.Draw(theSpriteBatch); castledoor.Draw(theSpriteBatch); foreach (Pipe aPipe in pipes) { if (aPipe.mSpritePosition.X > Camera.Instance.PositionX - tileSize && aPipe.mSpritePosition.X < Camera.Instance.PositionX + ScreenManager.Instance.Dimensions.X) { aPipe.Draw(theSpriteBatch); } } foreach (Ground aGround in ground) { if (aGround.mSpritePosition.X > Camera.Instance.PositionX - tileSize && aGround.mSpritePosition.X < Camera.Instance.PositionX + ScreenManager.Instance.Dimensions.X) { aGround.Draw(theSpriteBatch); } } foreach (Block aBlock in blocks) { if (aBlock.mSpritePosition.X > Camera.Instance.PositionX - tileSize && aBlock.mSpritePosition.X < Camera.Instance.PositionX + ScreenManager.Instance.Dimensions.X && !aBlock.IsDead) { aBlock.Draw(theSpriteBatch); } } foreach (Coin aCoin in coins) { if (aCoin.mSpritePosition.X > Camera.Instance.PositionX - tileSize && aCoin.mSpritePosition.X < Camera.Instance.PositionX + ScreenManager.Instance.Dimensions.X && !aCoin.IsDead) { aCoin.Draw(theSpriteBatch); } } foreach (Goomba aGoomba in goombas) { if (aGoomba.mSpritePosition.X > Camera.Instance.PositionX - tileSize && aGoomba.mSpritePosition.X < Camera.Instance.PositionX + ScreenManager.Instance.Dimensions.X && !aGoomba.IsDead || aGoomba.mSpritePosition.Y > ScreenManager.Instance.Dimensions.Y) { aGoomba.Draw(theSpriteBatch); } } foreach (Koopa aKoopa in koopas) { if (aKoopa.mSpritePosition.X > Camera.Instance.PositionX - tileSize && aKoopa.mSpritePosition.X < Camera.Instance.PositionX + ScreenManager.Instance.Dimensions.X && !aKoopa.IsDead || aKoopa.mSpritePosition.Y > ScreenManager.Instance.Dimensions.Y) { aKoopa.Draw(theSpriteBatch); } } foreach (Mushroom aMushroom in mushrooms) { if (aMushroom.mSpritePosition.X > Camera.Instance.PositionX - tileSize && aMushroom.mSpritePosition.X < Camera.Instance.PositionX + ScreenManager.Instance.Dimensions.X && !aMushroom.IsDead && !aMushroom.Hidden || aMushroom.mSpritePosition.Y > ScreenManager.Instance.Dimensions.Y) { aMushroom.Draw(theSpriteBatch); } } hud.Draw(theSpriteBatch); life.Draw(theSpriteBatch); score1.Draw(theSpriteBatch); score2.Draw(theSpriteBatch); player.Draw(theSpriteBatch); }