Sunday, July 17, 2022
HomeGame DevelopmentSpreet Sheet and animator for Cocos Creator - Cocos Creator

Spreet Sheet and animator for Cocos Creator – Cocos Creator


GitHub:

Preview:
http://yiyizu.com/spritesheet/

Just lately some builders requested find out how to use Sprite Sheet in Cocos Creater, since Cocos has not supported sprite sheet but, so that they have to make use of texturepacker to repack it into spriteatlas file.

On this demo, it would show find out how to use sprite sheet and animator for sprite sheet in Cocos.

anm1

By studying Cocos Sprite Part’s supply code, it’s came upon that Cocos makes use of assembler to updateUVs of the spriteframe, which is identical as Cocos 2.4.

And the spriteframe’s uv is created with its rect, so to make use of sprite sheet , it solely must recalculate the UV when it has to vary the body.

For the answer, firstly it wants the Tiles X&Y numbers, which is collected which Cocos’s property panel, and it is usually supported witch Json information.

Then it would caculate the rect’s width and top with the feel’s dimension divided by X&Y Tiles quantity.

Finally it makes use of shedule to replace the animation, which the body time from the config. (Shedule can set interval time extra precisely, and it is usually straightforward to cease and resume)

image

This resolution has not been accomplished but, it doesn’t help sprite atlas / auto-atlas.

Please disable bundle in spritesheet config.

Please give me some stars if u prefer it ^ ^.

Pixel Arts Used


RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments