4
\$\begingroup\$

One issue I have when working with API's such as Monogame and SFML unlike with Game Engines like Unity and Unreal is trying to extract sprites from a spritesheet. I know the method of doing it but it becomes really annoying when you use spritesheets for example that have lots of different sized sprites that are scattered all around the spritesheet. Everything seems to need to be perfectly sized and aligned to be able to extract the sprites correctly, unless you're using a game engine like Unity where you can do something like draw boxes around the sprites you want, no matter the size or position, or have this done for you.

What workflow can I use to quickly select the portions of the image corresponding to each sprite and use those extracted sprites right away in code instead of splitting the sprites into seperate .png's and using them?

\$\endgroup\$
  • 1
    \$\begingroup\$ I don't know if there exist an app or program that can do that. But you can, for instance, create a data file where it contains all of the needed coordinates and dimensions. Then use that file to extract your sprites from the spritesheets. \$\endgroup\$ – Greffin28 Nov 17 '17 at 7:16
  • \$\begingroup\$ @Greffin28 Such an atlas can be created by TexturePacker as described in my answer. \$\endgroup\$ – Christian Ivicevic Nov 17 '17 at 16:04
  • \$\begingroup\$ @ChristianIvicevic Nice to know, never looked for one before. But dang the price lol. \$\endgroup\$ – Greffin28 Nov 17 '17 at 16:44
1
\$\begingroup\$

You can use http://www.spritecow.com/ to do that. You can open an image and click on any part to get the coordinates and the size of sprite you need.

I've been using it for more than a year and it's really nice.

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

TexturePacker is an awesome tool which is about $40 which packs multiple textures/sprites into one optimized spritesheet. It exports the metadata about position, rotation etc. to generic formats usable right from various engines and it allows you to write own exporters.

Even though the application isn't cheap I highly recommend trying it out since there is a trial available.

\$\endgroup\$
0
\$\begingroup\$

From what it sounds like, you only have one spritesheet, and each sprite isn't in the same dimension as the others. In that case, you can try using the Automatic setting in the Sprite Editor.

--

If you have each individual sprite, you can alternatively use Stitches (http://draeton.github.io/stitches/) which is free. TexturePacker has a free version, but it's watermarked.

After you create a sprite sheet that doesn't have scattered sprites (e.g. each sprite is within the same pixel dimensions) you can automatically split them in one go using the Sprite Editor. Just set the slicing type to Grid by Cell Size/Count.

\$\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.