Untitled
unknown
plain_text
5 days ago
621 B
5
Indexable
/** * TP - extract textures from Texture Packer Spritesheet * @param base - base json file * @param texture - specific texture */ export function TP(base: string, texture: string): Texture { const arr: Frame[] = Assets.get(base)._frames; let i: number = 0; let id: number = 0; for (i = 0; i < arr.length; i++) { if (arr[i].filename == texture) { id = i; Assets.get(base).textures[id]; return Assets.get(base).textures[id]; } } return Assets.get(base).textures[id]; } /*usage Sprite(TP("base_game", "home.png")) */
Editor is loading...
Leave a Comment