This function returns an array with the UV coordinates and other data for the texture of the given tileset on the texture page. The function returns an array with the following 8 elements:
- [0] = left
- [1] = top
- [2] = right
- [3] = bottom
- [4] = amount of pixels the asset compiler has trimmed from the tileset left side
- [5] = amount of pixels the asset compiler has trimmed from the tileset top side
- [6] = normalised percentage of pixel data from the original tileset width that has been saved to the texture page
- [7] = normalised percentage of pixel data from the original tileset height that has been saved to the texture page
This array can then be used in other draw functions, particularly when working in 3D or using the 2D primitive functions, as well as when working with the Shader functions.
tileset_get_uvs(tileset);
Argument | Description |
---|---|
tileset | The index of the tileset to use. |
Array (1D, 8 elements)
var tex = tileset_get_uvs(tl_Grass);
tex_left = tex[0];
tex_top = tex[1];
tex_right = tex[2];
tex_bottom = tex[3];
The above code will store the UV coordinates for the given tileset in a local array and then assign the values to instance variables.