public Doorway(LevelManager manager, Point pos, Level linkedlevel, Point newPlayerPos) { this.manager = manager; linked = linkedlevel; playerPos = newPlayerPos; base.LoadContent(manager, "doorway", pos); }
/// <summary> /// Convenience function. See Game1.ChangeLevel /// </summary> /// <param name="level"></param> /// <param name="playerPos"></param> public void GoToLevel(Level level, Point playerPos) { if (level == ship_1) System.Diagnostics.Debug.WriteLine("Going to ship_1"); if (level == ship_2) System.Diagnostics.Debug.WriteLine("Going to ship_2"); if (level == ship_3) System.Diagnostics.Debug.WriteLine("Going to ship_3"); if (level == ship_4) System.Diagnostics.Debug.WriteLine("Going to ship_4"); game.ChangeLevel(level, playerPos); }
/// <summary> /// Changes level to specified level, moves player to point. /// </summary> /// <param name="level">Level to change to.</param> /// <param name="playerPos">Player's starting position in level.</param> public void ChangeLevel(Level level, Point playerPos) { currentLevel = level; tex = currentLevel.Texture; bounds = new Point(300, 200); rect = new Rectangle(0, 0, tex.Width, tex.Height); player.MoveTo(playerPos); rt = new RenderTarget2D(GraphicsDevice, 300, 200); }
public LevelManager(ContentManager cm, Game1 g) { content = cm; game = g; longg = new Level(content.Load<Texture2D>("Sprites/Levels/long")); ship_1 = new Level(content.Load<Texture2D>("Sprites/Levels/ship_1")); ship_2 = new Level(content.Load<Texture2D>("Sprites/Levels/ship_2")); ship_3 = new Level(content.Load<Texture2D>("Sprites/Levels/ship_3")); ship_4 = new Level(content.Load<Texture2D>("Sprites/Levels/ship_4")); ship_2.AddObject(new Doorway(this, new Point(15, 42), ship_3, new Point(116, 35))); ship_2.AddObject(new Doorway(this, new Point(80, 42), ship_4, new Point(27, 50))); ship_3.AddObject(new Doorway(this, new Point(131, 55), ship_2, new Point(36, 30))); ship_4.AddObject(new Doorway(this, new Point(10, 60), ship_2, new Point(65, 30))); }