/// <summary> /// Instantiates an enemy and puts him in the level. /// </summary> private Tile LoadEnemyTile(int x, int y, string spriteSet) { Vector2 position = RectangleExtensions.GetBottomCenter(GetBounds(x, y)); enemies.Add(new Enemy(this, position, spriteSet)); return(new Tile(null, TileCollision.Passable, TileMovement.Static)); }
/// <summary> /// Loads a gliding tile /// </summary> private Tile LoadGlidingTile(int x, int y, string name, FaceDirection faceDirection, float moveSpeed, float waitTime, TileMovement movement) { Vector2 position = RectangleExtensions.GetBottomCenter(GetBounds(x, y)); glidingPlatforms.Add(new GlidingPlatform(this, position, faceDirection, moveSpeed, waitTime, movement, name)); // Just like an enemy, we want the fixed tile behind it to be passable and invisible. return(new Tile(null, TileCollision.Passable, movement)); }
/// <summary> /// Instantiates a player, puts him in the level, and remembers where to put him when he is resurrected. /// </summary> private Tile LoadStartTile(int x, int y) { if (Player != null) { throw new NotSupportedException("A level may only have one starting point."); } start = RectangleExtensions.GetBottomCenter(GetBounds(x, y)); player = new Player(this, start); return(new Tile(null, TileCollision.Passable, TileMovement.Static)); }