JeZxLee Posted July 18, 2017 Share Posted July 18, 2017 Hi. Working on PNG image sprite core today. I looked at the demo's *.JSON file and see that is has image sizes. Must I specify image sizes in the *.JSON file? "blob.png": { "frame": {"x":55,"y":2,"w":32,"h":24}, "rotated": false, "trimmed": false, "spriteSourceSize": {"x":0,"y":0,"w":32,"h":24}, "sourceSize": {"w":32,"h":24}, "pivot": {"x":0.5,"y":0.5} }, (my game would have 100's of images and the above would be cumbersome. Let me know, Thanks! JeZxLee Quote Link to comment Share on other sites More sharing options...
JeZxLee Posted July 18, 2017 Author Share Posted July 18, 2017 Uggg, Seems like all the image sprites are in one giant single PNG? Do I have to do the above?? (I have about a 100 sprites in the game and the above would be a nightmare to do) JeZxLee Quote Link to comment Share on other sites More sharing options...
themoonrat Posted July 18, 2017 Share Posted July 18, 2017 There is a big performance advantage to have as few images loaded and used as possible. Therefore games tend to use 'sprite/texture atlases', in which lots of individual images are combined into one big one. Then the libs can use the json data to work out which part of that big image contains the smaller image needed to be displayed. Don't worry, it's not hand done, there are lots of tools to generate this all for you, like TexturePacker. Pixi can use the json format exported by that tool natively. Quote Link to comment Share on other sites More sharing options...
JeZxLee Posted July 18, 2017 Author Share Posted July 18, 2017 Ok, got it working - thanks! Screeenshot below:http://16bitsoft.com/files/PixiAudio5JS/DevPhotos/PixiSpritesPacked-01.png JeZxLee Quote Link to comment Share on other sites More sharing options...
xerver Posted July 18, 2017 Share Posted July 18, 2017 Like @themoonrat mentioned, I recommend not doing this by hand. Save all your images as separate files like you normally would then use a tools like TexturePacker or ShoeBox to generate the atlas image and associated json file. TexturePacker is worth every penny, but there are tons of other tools out there as well. Good luck! -Chad Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 18, 2017 Share Posted July 18, 2017 Beware, shoebox doesn't know about ("trimmed":true) , you have to add it manually or change their pixi exporter. Or just dont use "trimming" feature of shoebox. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.