Changes

Jump to navigation Jump to search
1,290 bytes added ,  22:08, 22 March 2020
+ tile transforms in SMAPI 3.4
Line 279: Line 279:  
: See [http://doc.mapeditor.org Tiled documentation].
 
: See [http://doc.mapeditor.org Tiled documentation].
   −
===Animated tiles===
+
===Tile animation===
 
[[File:Modding - creating an XNB mod - example animation.gif|right]]
 
[[File:Modding - creating an XNB mod - example animation.gif|right]]
 
You can animate tiles to create effects like Gil in his rocking chair (see example at right).
 
You can animate tiles to create effects like Gil in his rocking chair (see example at right).
Line 292: Line 292:  
private void OnSaveLoaded(object sender, SaveLoadedEventArgs args)
 
private void OnSaveLoaded(object sender, SaveLoadedEventArgs args)
 
{
 
{
   //add Animated Tile
+
  GameLocation location = Game1.currentLocation;
 +
 
 +
   // add animated tile
 
   Layer layer = location.map.GetLayer("Buildings");
 
   Layer layer = location.map.GetLayer("Buildings");
 
   TileSheet tilesheet = location.map.GetTilesheet("tilesheet name");
 
   TileSheet tilesheet = location.map.GetTilesheet("tilesheet name");
Line 316: Line 318:  
:# When you're done, close the pane.
 
:# When you're done, close the pane.
 
:# The animated tiles in the ''Tilesets'' pane will now have a little symbol in the bottom-right corner:<br />[[File:Modding - creating an XNB mod - Tiled example animation tileset.png]]<br />The animation is now part of that tile. Every instance of that tile on the map will now have the same animation.
 
:# The animated tiles in the ''Tilesets'' pane will now have a little symbol in the bottom-right corner:<br />[[File:Modding - creating an XNB mod - Tiled example animation tileset.png]]<br />The animation is now part of that tile. Every instance of that tile on the map will now have the same animation.
 +
 +
===Tile flip/rotation===
 +
{{SMAPI upcoming|3.4|
 +
[[File:Tiled tile rotation.png|thumb|An example tile rotated four ways, below the Tiled flip/rotate buttons.]]
 +
 +
You can rotate and flip tiles without needing to create rotated/flipped versions of the tilesheet. This needs SMAPI to be installed; the base game doesn't recognize tile transforms.
 +
 +
If you're using SMAPI:
 +
:<source lang="c#">
 +
public override void Entry(IModHelper helper)
 +
{
 +
  helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded;
 +
}
 +
 +
private void OnSaveLoaded(object sender, SaveLoadedEventArgs args)
 +
{
 +
  // get a tile
 +
  GameLocation location = Game1.currentLocation;
 +
  Layer layer = location.map.GetLayer("Buildings");
 +
  Tile tile = layer.Tiles[tileX, tileY];
 +
 
 +
  // rotate it 45°
 +
  tile.Properties["@Rotation"] = 45;
 +
 +
  // flip it (0 = normal, 1 = horizontal, 2 = vertical)
 +
  tile.Properties["@Flip"] = 1;
 +
}
 +
</source>
 +
 +
If you're using Tiled:
 +
: '''Note: this only works when editing a <tt>.tmx</tt> file. Tile transforms aren't supported by the <tt>.tbin</tt> plugin.
 +
 +
:# With the stamp tool selected, click the tile in the tilesheet you want to use.
 +
:# Click the flip or rotate buttons (see image at right).
 +
:# Click the map to place the flipped/rotated tile.
 +
}}
    
==Known properties==
 
==Known properties==
translators
8,403

edits

Navigation menu