Actions

Template

Difference between revisions of "GetTile"

From Sonic Retro

 
(3 intermediate revisions by one other user not shown)
Line 2: Line 2:
 
{{#vardefine:x|0}}{{#vardefine:y|0}}{{#vardefine:n|{{#expr:{{#var:hexid}}*{{{tilesize}}}}}}}
 
{{#vardefine:x|0}}{{#vardefine:y|0}}{{#vardefine:n|{{#expr:{{#var:hexid}}*{{{tilesize}}}}}}}
 
{{#while:
 
{{#while:
|{{#ifexpr:{{#var:n}} > {{#var:imagewidth}}|true}}
+
|{{#ifexpr:{{#var:n}} >= {{#var:imagewidth}}|true}}
 
|{{#vardefine:n|{{#expr:{{#var:n}}-{{#var:imagewidth}}}}}}{{#vardefine:y|{{#expr:{{#var:y}} + {{{tilesize}}}}}}}
 
|{{#vardefine:n|{{#expr:{{#var:n}}-{{#var:imagewidth}}}}}}{{#vardefine:y|{{#expr:{{#var:y}} + {{{tilesize}}}}}}}
 
}}
 
}}
{{#vardefine:x|{{#var:n}}}}</div>{{SpriteImage|{{{image|}}}
+
{{#vardefine:x|{{#var:n}}}}</div>{{SpriteImage|{{{image|}}}|{{{scale|}}}
 
| crop_width={{{tilesize}}}
 
| crop_width={{{tilesize}}}
 
| crop_height={{{tilesize}}}
 
| crop_height={{{tilesize}}}
Line 11: Line 11:
 
| crop_y={{#var:y}}
 
| crop_y={{#var:y}}
 
}}{{clearvar|x|y}}</includeonly><noinclude>
 
}}{{clearvar|x|y}}</includeonly><noinclude>
 +
Get the a tile in a tileset with a supplied hexadecimal number:
 +
<pre>{{GetTile
 +
| image=Sonic1 MD Map MZ chunks.png
 +
| tilesize=256
 +
| id=4
 +
}}</pre>
 
{{GetTile
 
{{GetTile
 
| image=Sonic1 MD Map MZ chunks.png
 
| image=Sonic1 MD Map MZ chunks.png
Line 16: Line 22:
 
| id=4
 
| id=4
 
}}
 
}}
 +
<pre>{{GetTile
 +
| image=Sonic1 MD Map MZ chunks.png
 +
| tilesize=256
 +
| id=13
 +
}}</pre>
 
{{GetTile
 
{{GetTile
 
| image=Sonic1 MD Map MZ chunks.png
 
| image=Sonic1 MD Map MZ chunks.png
Line 21: Line 32:
 
| id=13
 
| id=13
 
}}
 
}}
 +
<pre>{{GetTile
 +
| image=Sonic1 MD Map MZ chunks.png
 +
| tilesize=256
 +
| id=32
 +
}}</pre>
 
{{GetTile
 
{{GetTile
 
| image=Sonic1 MD Map MZ chunks.png
 
| image=Sonic1 MD Map MZ chunks.png
Line 26: Line 42:
 
| id=32
 
| id=32
 
}}
 
}}
 
+
<pre>{{GetTile
[[Category:Sonic Retro templates]]</noinclude>
+
| image=Sonic1 MD Map SLZ chunks.png
 +
| tilesize=256
 +
| id=38
 +
}}</pre>
 +
{{GetTile
 +
| image=Sonic1 MD Map SLZ chunks.png
 +
| tilesize=256
 +
| id=38
 +
}}
 +
[[Category:Templates]]</noinclude>

Latest revision as of 19:20, 1 January 2022

Get the a tile in a tileset with a supplied hexadecimal number:

{{GetTile
| image=Sonic1 MD Map MZ chunks.png
| tilesize=256
| id=4
}}
4


Sonic1 MD Map MZ chunks.png
{{GetTile
| image=Sonic1 MD Map MZ chunks.png
| tilesize=256
| id=13
}}
19


Sonic1 MD Map MZ chunks.png
{{GetTile
| image=Sonic1 MD Map MZ chunks.png
| tilesize=256
| id=32
}}
50


Sonic1 MD Map MZ chunks.png
{{GetTile
| image=Sonic1 MD Map SLZ chunks.png
| tilesize=256
| id=38
}}
56


Sonic1 MD Map SLZ chunks.png