// preload any game objects that have textures private static void preloadTexturedObjects() { // dont save references to any preloaded objects Hero preloadHero = new Hero(); preloadHero.remove(); Enemy preloadEnemy = new BrainEnemy(new Vector2(-100f, -100f), 0, preloadHero); preloadEnemy.remove(); (new RedBeamEnemy(new Vector2(-100f, -100f), 0, preloadHero)).remove(); (new SpiderEnemy(new Vector2(-100f, -100f), 0, preloadHero)).remove(); (new DyePack(preloadHero, -200f, -100f, Blue)).remove(); (new DyePack(preloadHero, -200f, -100f, Green)).remove(); (new DyePack(preloadHero, -200f, -100f, Yellow)).remove(); (new DyePack(preloadHero, -200f, -100f, Red)).remove(); (new DyePack(preloadHero, -200f, -100f, Pink)).remove(); (new DyePack(preloadHero, -200f, -100f, Teal)).remove(); (new SpeedUp(preloadHero, -200f, -100f)).remove(); (new Ghost(preloadHero, -200f, -100f)).remove(); (new Overload(preloadHero, -200f, -100f)).remove(); (new Invincibility(preloadHero, -200f, -100f)).remove(); new Explosion(preloadHero, preloadEnemy); }
public override void remove() { // clean up game objects - remove from draw set // GameWorld expects this to be called before destroying the GameWorld instance // -- that is, it does not restore game objects to draw set foreach (GameWorldRegion region in onscreen) { region.remove(); } foreach (GameWorldRegion region in upcoming) { region.remove(); } hero.remove(); eManager.remove(); infoPanel.remove(); laser.remove(); }