AntoniaChimp Posted April 26, 2019 Share Posted April 26, 2019 Hello ! I read about using Sprite Sheets in Pixi and about creating needed JSON files with Texture Packer. But I already got the Sprite Atlas/Sheet. Is there an easy way or a tool to create the corresponding JSON file anyways ? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted April 26, 2019 Share Posted April 26, 2019 How to create texture region in pixi: "new PIXI.Texture(baseTexture, new PIXI.Rectangle(x,y,w,h))" As for tool, maybe http://renderhjs.net/shoebox/ can do that. Quote Link to comment Share on other sites More sharing options...
AntoniaChimp Posted April 26, 2019 Author Share Posted April 26, 2019 18 minutes ago, ivan.popelyshev said: How to create texture region in pixi: "new PIXI.Texture(baseTexture, new PIXI.Rectangle(x,y,w,h))" As for tool, maybe http://renderhjs.net/shoebox/ can do that. So I would have to figure out placing of the sprites in the sprite sheet my own ? I will have a look at shoebox! Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted April 26, 2019 Share Posted April 26, 2019 Yes, if the layout is obvious you can create textures manually, no need for complexity Quote Link to comment Share on other sites More sharing options...
botmaster Posted April 26, 2019 Share Posted April 26, 2019 If there's no rotation involved making a spritesheet parser for any tool is very easy even for people who hate math. It comes usually with a xml or json that lists frames with position, dimension, and names. You extract those names in a loop, create rectangles out of position/dimension, put everything in a dic and voila, now you can run another loop to create texture from the main texture and pass along those frames(rectangles) you created when parsing. NO MATH involved. ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted April 28, 2019 Share Posted April 28, 2019 > NO MATH involved. My nightmare. Let me tell you about D8 Group! https://en.wikipedia.org/wiki/Dihedral_group It has 16 elements, all rotations of octagon. 12-th rotation will be FlipX, thus you can specify "texture.rotate=12" and all sprites that have that texture will be flipped horizontally! See? Its easy! 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.