I want to split images from spritesheet with non-uniform sprite dimensions. What is the best way to split images this?
Here’s an example of non-uniform sprite dimensions.
Thanks.
I want to split images from spritesheet with non-uniform sprite dimensions. What is the best way to split images this?
Here’s an example of non-uniform sprite dimensions.
Thanks.
You have to identify them before you go to code, manually. I’d try with this format.
//ObjectName x, y, width, height
Turt1 0 0 12 10
Turt2 60 0 12 16
Then write your code to get the appropriate regions.
You’ll probably want an x & y origin for each frame too.
Many open source tools exist for handling sprite sheets.
Try not to reinvent the wheel.
I just use my own packer
www.rel.phatcode.net/junk.php?id=106
Then load the sprite via a loader I made.
Loader is in the /src folder.
create a method called getsprite(int x, int y , int bound x, int boundy); then have it use for loops like so for(int xx = 0;xx < boundx;xx++){for(int yy = 0; yy < boundy;yy++){ pix[xx][yy] = imagepix[xx+x][yy+y];}}