Difference between revisions of "GetTile"
From Sonic Retro
(Created page with "<includeonly><!--{{clearvar|result}}<div style="display:none;">{{Hex2Dec|{{{id|}}}}}{{#vardefine:hexid|{{#var:hex2decresult}}}}{{#vardefine:imagewidth|{{#mediawidth:{{{image|}...") |
BSonirachi (talk | contribs) m (Text replacement - "Category:Sonic Retro templates" to "Category:Templates") |
||
(4 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | <includeonly> | + | <includeonly>{{clearvar|result}}<div style="display:none;">{{Hex2Dec|{{{id|}}}}}{{#vardefine:hexid|{{#var:hex2decresult}}}}{{#vardefine:imagewidth|{{#mediawidth:{{{image|}}}}}}} |
{{#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: | + | | 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 }}
{{GetTile | image=Sonic1 MD Map MZ chunks.png | tilesize=256 | id=13 }}
{{GetTile | image=Sonic1 MD Map MZ chunks.png | tilesize=256 | id=32 }}
{{GetTile | image=Sonic1 MD Map SLZ chunks.png | tilesize=256 | id=38 }}