kay Posted May 13, 2014 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. Link to comment Share on other sites More sharing options...
rich Posted May 13, 2014 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 Link to comment Share on other sites More sharing options...
kay Posted May 13, 2014 Author 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. Link to comment Share on other sites More sharing options...
rich Posted May 13, 2014 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) Link to comment Share on other sites More sharing options...
kay Posted May 13, 2014 Author 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. Link to comment Share on other sites More sharing options...
rich Posted May 13, 2014 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. Link to comment Share on other sites More sharing options...
It's-The-Bat Posted July 23, 2015 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 Link to comment Share on other sites More sharing options...
Skeptron Posted July 23, 2015 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. Link to comment Share on other sites More sharing options...
It's-The-Bat Posted July 26, 2015 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? Link to comment Share on other sites More sharing options...
Skeptron Posted July 27, 2015 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. Link to comment Share on other sites More sharing options...
It's-The-Bat Posted July 27, 2015 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. Link to comment Share on other sites More sharing options...
Recommended Posts