punkice3407 / ObjectBuilder

MIT License
52 stars 39 forks source link

Error after compile 128px based sprites... #18

Closed Luury closed 1 year ago

Luury commented 2 years ago

When I compile with sprites in a size greater than 128px it works normally in the game, but when I open it again and load the .dat and .spr, the following error appears:

First time: (Normal) image Ingame: (Normal) image

After Open again in Obj Builder: image

Already tried:

*EDIT 1:** ~This error only occurs if I cut with the slicer or import an image and let the object builder cut it for me, if I put sprite by sprite, this error does not occur.~

*EDIT 2: ~I found out that it has something related to the amount of colors, if the sprite has many different colors, this error happens, maybe I have to use less bits?**~ image

*EDIT 3: I found what really causes the problem, the sprite has to have at least one pixel with the alpha channel fully transparent, if not, the error happens, but why is that? (This makes making grounds impossible)**

*EDIT 4:** For some reason, when I add a sprite, the object builder in the uncompressPixels() function reads its length normally, however, if I compile and reload the files again, its length is equal to 4, the problem is there, does anyone know the reason ? The error occurs when call .readUnsignedByte(); image

Luury commented 1 year ago

I fix this, there are many modifications, you have to change the types of variables to read the bits correctly, the variables that are currently have a limit.