C# Class GameEngine.Tiled.TiledMap

Inheritance: PropertyBag, ILoadable
Mostrar archivo Open project: MichaelAquilina/Some-2D-RPG Class Usage Examples

Public Methods

Method Description
GetObjectLayerByName ( string name ) : TiledObjectLayer
GetPxTile ( float px, float py, int layerIndex ) : Tile
GetPxTopMostTile ( Vector2 pos ) : Tile
GetPxTopMostTile ( float px, float py ) : Tile
GetTileBounds ( Vector2 txPos ) : Rectangle

Returns the rectangular bounds for the tile at the specified coordinate. The coordinate passed should in tile coordinates (TX) rather than map pixel coordinates (PX).

GetTileLayerByName ( string name ) : TileLayer
GetTxTile ( int tx, int ty, int layerIndex ) : Tile
GetTxTopMostTile ( int tx, int ty ) : Tile

Retrieves the Topmost tile at the specified (X,Y) location on the map. By top most, the function refers to the draw order, i.e. the tile which would be shown on top. The first non-zero tile found from the top will be returned by this function. Tiles found in Tile layers marked as "Foreground" are not included. If no non-zero tile is found in any layer, then a null value is returned.

LoadContent ( Microsoft.Xna.Framework.Content.ContentManager content ) : void
LoadTmxFile ( string file ) : TiledMap
PxToTx ( Vector2 position ) : Vector2

Converts the specfied global world (px) coordinates into its relevant tile coordinate.

TiledMap ( ) : System
ToString ( ) : string
TxToPx ( Vector2 position, bool center = true ) : Vector2

Converts the specified tile (tx) coordinates into global world (px) coordinates. The result returned will be situated at the very center for the specified tile coordinate if the center parameter is specified as true.

Private Methods

Method Description
ConvertToPointsList ( string pointData ) : List

Method Details

GetObjectLayerByName() public method

public GetObjectLayerByName ( string name ) : TiledObjectLayer
name string
return TiledObjectLayer

GetPxTile() public method

public GetPxTile ( float px, float py, int layerIndex ) : Tile
px float
py float
layerIndex int
return Tile

GetPxTopMostTile() public method

public GetPxTopMostTile ( Vector2 pos ) : Tile
pos Vector2
return Tile

GetPxTopMostTile() public method

public GetPxTopMostTile ( float px, float py ) : Tile
px float
py float
return Tile

GetTileBounds() public method

Returns the rectangular bounds for the tile at the specified coordinate. The coordinate passed should in tile coordinates (TX) rather than map pixel coordinates (PX).
public GetTileBounds ( Vector2 txPos ) : Rectangle
txPos Vector2
return Microsoft.Xna.Framework.Rectangle

GetTileLayerByName() public method

public GetTileLayerByName ( string name ) : TileLayer
name string
return TileLayer

GetTxTile() public method

public GetTxTile ( int tx, int ty, int layerIndex ) : Tile
tx int
ty int
layerIndex int
return Tile

GetTxTopMostTile() public method

Retrieves the Topmost tile at the specified (X,Y) location on the map. By top most, the function refers to the draw order, i.e. the tile which would be shown on top. The first non-zero tile found from the top will be returned by this function. Tiles found in Tile layers marked as "Foreground" are not included. If no non-zero tile is found in any layer, then a null value is returned.
public GetTxTopMostTile ( int tx, int ty ) : Tile
tx int integer X value.
ty int integer Y value.
return Tile

LoadContent() public method

public LoadContent ( Microsoft.Xna.Framework.Content.ContentManager content ) : void
content Microsoft.Xna.Framework.Content.ContentManager
return void

LoadTmxFile() public static method

public static LoadTmxFile ( string file ) : TiledMap
file string
return TiledMap

PxToTx() public method

Converts the specfied global world (px) coordinates into its relevant tile coordinate.
public PxToTx ( Vector2 position ) : Vector2
position Vector2
return Vector2

TiledMap() public method

public TiledMap ( ) : System
return System

ToString() public method

public ToString ( ) : string
return string

TxToPx() public method

Converts the specified tile (tx) coordinates into global world (px) coordinates. The result returned will be situated at the very center for the specified tile coordinate if the center parameter is specified as true.
public TxToPx ( Vector2 position, bool center = true ) : Vector2
position Vector2
center bool
return Vector2