Changes

Jump to navigation Jump to search
371 bytes added ,  20:17, 19 October 2017
→‎Tile properties: + remove tile property
Line 165: Line 165:  
public void Entry(IModHelper helper)
 
public void Entry(IModHelper helper)
 
{
 
{
   // get
+
   // get property
 
   string value = Game1.currentLocation.doesTileHaveProperty(tileX, tileY, "Diggable", "Back");
 
   string value = Game1.currentLocation.doesTileHaveProperty(tileX, tileY, "Diggable", "Back");
   −
   // add or set value
+
   // add or set property
 
   Game1.currentLocation.setTileProperty(tileX, tileY, "Back", "Diggable", "T");
 
   Game1.currentLocation.setTileProperty(tileX, tileY, "Back", "Diggable", "T");
 +
 +
  // remove tile property
 +
  Layer layer = Game1.currentLocation.map.GetLayer("Back");
 +
  Tile tile = layer.PickTile(new xTile.Dimensions.Location(x, y) * Game1.tileSize, Game1.viewport.Size);
 +
  tile.Properties.Remove("Diggable");
 +
  //tile.TileIndexProperties.Remove("Diggable"); // NOTE: removing a tile index property will affect all tiles of this type
 
}
 
}
 
</source>
 
</source>
translators
8,401

edits

Navigation menu