kay Posted May 13, 2014 Report Share Posted May 13, 2014 I have a PNG spritesheet I want to use in Phaser. But somehow I'm only able to access the first "row" of it. This is how I tried it:game.load.spritesheet( 'main', 'res/my_sprite_sheet.png', 32, 32);...game.add.sprite( 10, 10, 'main', 100);One row only has 30 frames, so I guessed, a bigger number would automatically overflow and lead to the next row. Quote Link to comment Share on other sites More sharing options...
rich Posted May 13, 2014 Report Share Posted May 13, 2014 It can read from multiple rows happily but only if you give it a total number of frames to read (the 5th parameter), otherwise it doesn't know when to stop grabbing frames. Tilde 1 Quote Link to comment Share on other sites More sharing options...
kay Posted May 13, 2014 Author Report Share Posted May 13, 2014 Ah, I thought with frame height, frame width, image height and image width, it had all the informations to calculate this on its own. Thank you. Quote Link to comment Share on other sites More sharing options...
rich Posted May 13, 2014 Report Share Posted May 13, 2014 It almost does, unless the sprite sheet looks like this: http://examples.phaser.io/assets/sprites/metalslug_mummy37x45.png (which is extremely common) Quote Link to comment Share on other sites More sharing options...
kay Posted May 13, 2014 Author Report Share Posted May 13, 2014 So it simply stops at the end of the row, if I don't set a frame count? Strange that I didn't get some "frame doesn't exist" error. Quote Link to comment Share on other sites More sharing options...
rich Posted May 13, 2014 Report Share Posted May 13, 2014 No of course not, it will take width, multiply it by the height and use that as the frame total. Which is often wrong and results in blank / empty frames in your animations. Quote Link to comment Share on other sites More sharing options...
It's-The-Bat Posted July 23, 2015 Report Share Posted July 23, 2015 Hey this may be an old post, but I seriously need help here. Can anyone tell me how to utilize a spritesheet that looks like this?https://ichiwamaru.files.wordpress.com/2007/11/zero.png Quote Link to comment Share on other sites More sharing options...
Skeptron Posted July 23, 2015 Report Share Posted July 23, 2015 You could use a software like TexturePacker (there's a free version which has more than enough features), which would generate a nice JSON. Phaser can read this JSON and map the spritesheet to it. Quote Link to comment Share on other sites More sharing options...
It's-The-Bat Posted July 26, 2015 Report Share Posted July 26, 2015 I have a question that's been itching in my mind for quite some time...how do I use Texture packer when I already have all the sprites in a sprite sheet? Do I have to crop each individual sprite? Quote Link to comment Share on other sites More sharing options...
Skeptron Posted July 27, 2015 Report Share Posted July 27, 2015 There are good softwares for cutting the spritesheet into multiple images. Can't remember the name though... =( But I think you can find them pretty easily. Quote Link to comment Share on other sites More sharing options...
It's-The-Bat Posted July 27, 2015 Report Share Posted July 27, 2015 Ok, thanks! I'll look into it. If anything else I'll reply back to this topic. Thanks again everyone. 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.