Monday, July 25, 2022
HomeGame DevelopmentSprite Sheet and animator for Cocos Creator - Cocos Creator

Sprite 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 display 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 alter the body.

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

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

Ultimately it makes use of schedule to replace the animation, with the body time from the property config. (Schedule can set interval time extra precisely, and additionally it is straightforward to cease and resume)

image

This answer has not been accomplished but, it doesn’t assist sprite atlas / auto-atlas in the meanwhile.

Please disable package deal in spritesheet config.

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

Pixel Arts Used




5 Likes

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments