0
\$\begingroup\$

I'm new to game development, so please be kind if this is a very simple question.

I have a Sprite sheet with 18 frames of the same character (6 col x 3 rows) moving slightly. I want to get the frames cut out of the sheet into cocos2dx project. There is no xml or plist defining the boundaries but obviously I want the Sprite to be in the same place as it animates as it's an idle action. What's the quickest way to get the frames? I tried texture packer but it seems designed to build a sheet not unpack one?

\$\endgroup\$
1
\$\begingroup\$

what are you looking for is ShoeBox sprite sheet editor.

\$\endgroup\$
  • \$\begingroup\$ I've written a more basic version of this, but that's a good util if you need to be able to align your frames. \$\endgroup\$ – ErnieDingo Jul 3 '18 at 21:41
0
\$\begingroup\$

This probably isn't answering much, but if you take a look at Coco's documentation, they explain how to do so with SpriteFrame. It's also done with a mixture of Rectangles it seems.

So it looks like you need to initialize a sprite frame, and mark it with the correct rectangles. Store it in a vector or , rinse and repeat. It might seem a bit redundant, but truth of the matter is that this is the most graceful thing I have seen for 2D APIs. :/

I guess if you want it to be specific for each file you load in, than you'll need to add that feature yourself. Most of the time, the sprite rectangles are the same size, with the sprite centered correctly enough that they won't move.

I hope this helped!

http://www.cocos2d-x.org/reference/native-cpp/V3.1rc0/d3/d35/classcocos2d_1_1_sprite_frame.html

http://www.cocos2d-x.org/wiki/Sprite_Sheet_Animation

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.