OccupyTileWorld
Introduction
Code Example
// Assumes Player is a valid entity
if(InputManager.Keyboard.KeyDown(Keys.Right))
{
var isTileOccupied = tileNodeNetwork.IsTileOccupiedWorld(
Player.X + 16, // assumes tiles are 16 pixels
Player.Y);
if(!isTileOccupied)
{
// un-occupy the current tile:
tileNodeNetwork.Unoccupy(this);
tileNodeNetwork.OccupyTileWorld(
Player.X + 16,
Player.Y,
Player);
// Move the player to the tile, either by setting the position
// directly, or by setting velocity or doing some other form of
// interpolation.
}
}Last updated
Was this helpful?