public static GetBottomCenter ( this rect ) : Vector2 | ||
rect | this | |
Результат | Vector2 |
/// <summary> /// Instantiates an enemy and puts him in the level. /// </summary> private Tile LoadSpikeTile(int x, int y) { Vector2 position = RectangleExtensions.GetBottomCenter(GetBounds(x, y)); spikes.Add(new Spike(this, position)); return(new Tile(null, TileCollision.Passable)); }
/// <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)); }
private Tile LoadBridgeTile(int x, int y, TileCollision collision) { Vector2 position = RectangleExtensions.GetBottomCenter(GetBounds(x, y)); Tile bridgeTile = new Tile(Content.Load <Texture2D>("Tiles/bridge"), collision); bridgeTiles[x, y] = bridgeTile; return(bridgeTiles[x, y]); }
/// <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, int id) { //if (Player != null) // throw new NotSupportedException("A level may only have one starting point."); start = RectangleExtensions.GetBottomCenter(GetBounds(x, y)); PlatformerGame.Players[id].Reset(start); return(new Tile(null, TileCollision.Passable)); }
/// <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, lives); return(new Tile(null, TileCollision.Passable)); }
/// <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."); } Rectangle bounds = GetBounds(x, y); Vector2 bottom = new Vector2(bounds.X + bounds.Width / 2.0f, bounds.Bottom); start = RectangleExtensions.GetBottomCenter(GetBounds(x, y)); player = new Player(this, start); return(new Tile(null, TileCollision.Passable)); }
/// <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."); } Rectangle rect = new Rectangle(x * Tile.Width, y * Tile.Height, Tile.Width, Tile.Height); Vector2 c = new Vector2(rect.X + rect.Width / 2.0f, rect.Bottom); start = RectangleExtensions.GetBottomCenter(GetBounds(x, y)); player = new Player(this, start); return(new Tile(null, TileCollision.Passable)); }