Difference between revisions of "GetTile"
From Sonic Retro
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}}}}}}} | ||
}} | }} | ||
Line 42: | Line 42: | ||
| id=32 | | id=32 | ||
}} | }} | ||
− | + | <pre>{{GetTile | |
− | + | | 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:Sonic Retro templates]]</noinclude> | [[Category:Sonic Retro templates]]</noinclude> |
Revision as of 15:25, 9 January 2021
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 }}