public GameWorld CheckWorldChange(Game g, PlayerGuy player) { if (bounds.Contains(new Point((int)player.Position.X, (int)player.Position.Y))) { player.Position = newPosition; return new GameWorld(player.Position, g, destination); } else return null; }
public GameWorld(Vector2 playerPos, Game game, string name) { world = new World(9.8f * Vector2.UnitY); globalLighting = new KryptonEngine(game, "KryptonEffect"); globalLighting.Initialize(); tiles = new List<Tile>(); collisionMap = new List<StaticBody>(); objects = new List<GameObject>(); triggers = new List<Trigger>(); toAdd = new List<GameObject>(); Load(game, name); player = new PlayerGuy(world, playerPos.X, playerPos.Y, MainGame.texPlayer); objects.Add(player); // Player will have an index of -1 camera = new Camera(player.Position, size, 15f, this.player); }