public MarioFinish(Mario mario, Game1 game, IBackground flag) : base(mario.Position, mario.Velocity, mario.Acceleration) { this.mario = mario; mario.Position = new Vector2(flag.Position.X + 2.5f, mario.Position.Y); Collision = new FinishCollision(); Movement = new FinishMovement(game); this.game = game; mario.UpReleased(); mario.Right(); if (mario.State.Name == "Big") { mario.State = new BigOnFlagState(mario); } else if (mario.State.Name == "Fire") { mario.State = new FireOnFlagState(mario); } else if (mario.State.Name == "Small") { mario.State = new SmallOnFlagState(mario); } foreach (IBackground ib in game.WorldLoader.Background) { if (ib is ToadCastle) { castle = (ToadCastle)ib; break; } } }
static LevelLoader() { // Mario loader loaders.Add("mario", (game, x, y) => { game.Mario = new Entities.Mario.Mario(game, x, y); }); LevelLoader_Block1(); LevelLoader_Block2(); // Enemy loaders loaders.Add("goomba", (game, x, y) => { game.WorldLoader.Enemies.Add(new Goomba(game, x, y)); }); loaders.Add("koopa", (game, x, y) => { game.WorldLoader.Enemies.Add(new Koopa(game, x, y)); }); loaders.Add("boss", (game, x, y) => { game.WorldLoader.Enemies.Add(new Bowser(game, x - 1, y - 1)); }); loaders.Add("lakitu", (game, x, y) => { game.WorldLoader.Enemies.Add(new Lakitu(game, x, y)); }); // Pipe loader loaders.Add("pipeTop", (game, x, y) => { Pipe pipe = new Pipe("Top", game) { Position = new Vector2(x, y) }; game.WorldLoader.Pipes.Add(pipe); game.Map.SetBlock(x, y, pipe); game.Map.SetHiddenBlock(x, y + 1, pipe); game.Map.SetHiddenBlock(x + 1, y, pipe); game.Map.SetHiddenBlock(x + 1, y + 1, pipe); }); loaders.Add("UGpipeTop", (game, x, y) => { Pipe pipe = new Pipe("UGTop", game); pipe.Position = new Vector2(x, y); game.WorldLoader.Pipes.Add(pipe); game.Map.SetBlock(x, y, pipe); game.Map.SetHiddenBlock(x, y + 1, pipe); game.Map.SetHiddenBlock(x + 1, y, pipe); game.Map.SetHiddenBlock(x + 1, y + 1, pipe); }); loaders.Add("pipeBody", (game, x, y) => { Pipe pipeBody = new Pipe("Body", game); pipeBody.Position = new Vector2(x, y); game.WorldLoader.Pipes.Add(pipeBody); game.Map.SetBlock(x, y, pipeBody); game.Map.SetHiddenBlock(x + 1, y, pipeBody); }); loaders.Add("SWPipeEntrance", (game, x, y) => { Pipe pipeBody = new Pipe("SWEntrance", game); pipeBody.Position = new Vector2(x, y); game.WorldLoader.Pipes.Add(pipeBody); game.Map.SetBlock(x, y, pipeBody); game.Map.SetHiddenBlock(x + 1, y, pipeBody); game.Map.SetHiddenBlock(x, y + 1, pipeBody); game.Map.SetHiddenBlock(x + 1, y + 1, pipeBody); }); loaders.Add("SWPipeBody", (game, x, y) => { Pipe pipeBody = new Pipe("SWBody", game); pipeBody.Position = new Vector2(x, y); game.WorldLoader.Pipes.Add(pipeBody); game.Map.SetBlock(x, y, pipeBody); game.Map.SetBlock(x, y + 1, pipeBody); }); //Item loaders loaders.Add("coin", (game, x, y) => { IItem coin = new Coin(game, new Vector2(x, y - 1)); coin.Position = new Vector2(x, y); game.WorldLoader.Items.Add(coin); }); loaders.Add("flagPole", (game, x, y) => { IItem flagPole = new FlagPole(game); flagPole.Position = new Vector2(x, y); flagPole.Bounds = new Rectangle(x, y, 1, 12 - y); game.WorldLoader.Items.Add(flagPole); }); // Background loaders loaders.Add("bush", (game, x, y) => { IBackground bush = new Bush(); bush.Position = new Vector2(x, y); game.WorldLoader.Background.Add(bush); }); loaders.Add("bushMid", (game, x, y) => { IBackground bushmid = new BushMid(); bushmid.Position = new Vector2(x, y); game.WorldLoader.Background.Add(bushmid); }); loaders.Add("bushLong", (game, x, y) => { IBackground bushlong = new BushLong(); bushlong.Position = new Vector2(x, y); game.WorldLoader.Background.Add(bushlong); }); loaders.Add("hill", (game, x, y) => { IBackground hill = new Hill(); hill.Position = new Vector2(x, y); game.WorldLoader.Background.Add(hill); }); loaders.Add("cloud", (game, x, y) => { IBackground cloud = new Cloud(); cloud.Position = new Vector2(x, y); game.WorldLoader.Background.Add(cloud); }); loaders.Add("cloudMid", (game, x, y) => { IBackground cloudMid = new CloudMid(); cloudMid.Position = new Vector2(x, y); game.WorldLoader.Background.Add(cloudMid); }); loaders.Add("cloudLong", (game, x, y) => { IBackground cloudlong = new CloudLong(); cloudlong.Position = new Vector2(x, y); game.WorldLoader.Background.Add(cloudlong); }); loaders.Add("castle", (game, x, y) => { IBackground castle = new ToadCastle(); castle.Position = new Vector2(x, y); game.WorldLoader.Background.Add(castle); }); loaders.Add("flag", (game, x, y) => { Flag flag = new Flag(new Vector2(x, y)); game.WorldLoader.Background.Add(flag); }); loaders.Add("lavaTop", (game, x, y) => { IBackground lavatop = new LavaTop { Position = new Vector2(x, y) }; game.WorldLoader.Background.Add(lavatop); }); loaders.Add("LavaBot", (game, x, y) => { IBackground lavatop = new LavaBot { Position = new Vector2(x, y) }; game.WorldLoader.Background.Add(lavatop); }); loaders.Add("BridgeChain", (game, x, y) => { IBackground bc = new BridgeChain { Position = new Vector2(x, y) }; game.WorldLoader.Background.Add(bc); }); loaders.Add("Hammer", (game, x, y) => { game.WorldLoader.Items.Add(new Hammer(game, new Vector2(x, y))); }); }