sprite_get_uvs


语法:

sprite_get_uvs(sprite, subimage);

参数 描述
sprite 将被使用的精灵的索引。
subimage 精灵的次级图像的索引。


返回

Array (1D, 8 elements)


描述

This function returns an array with the UV coordinates and other data for the texture of the sprite sub-image on the texture page. The function returns an array with the following 8 elements:

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.

注意: This function will not work with vector sprites or skeleton animation sprites.


例如:

var tex = sprite_get_uvs(sprite, 0);
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 sprite in a local array and then assign the values to instance variables.