sergil Posted November 14, 2013 Share Posted November 14, 2013 Hi! I was testing buttons and I saw that for buttons I need a spritesheet. May I need creatig separate spritesheets for all the buttons or can I use a atlas texture with all the game elements and refer somewhere the normal, over and press images? christianstrang 1 Link to comment Share on other sites More sharing options...
Alvin Posted November 14, 2013 Share Posted November 14, 2013 Have a look at the Button constructor, when you create it, you need to specify the over,out and down frames, and the spritesheet used can be as large as you want. Link to comment Share on other sites More sharing options...
sergil Posted November 14, 2013 Author Share Posted November 14, 2013 In the buttons examples, I see that Phaser use a spritesheet and the specify the over,out and down frames, but the way I think Phaser uses the spritesheet for this examples is dividing it in 3 frames, and the the first frame is the over, the second is the out and the third is the down. If I use a texture atlas with all the sprites of the game (which will be of different sizes), how can I know which frame will be the over,out and down ? Playing with shoebox, I realize that sometimes it constructs the atlas with the sprites in different order, and the normal way to call the frames will be by sprite name? What do you think? Link to comment Share on other sites More sharing options...
sergil Posted November 17, 2013 Author Share Posted November 17, 2013 I haven't find the solution yet... Link to comment Share on other sites More sharing options...
haden Posted November 19, 2013 Share Posted November 19, 2013 When you use a texture atlas, for example with Shoebox, each frame is stored in the atlas with it's filename as an ID. In phaser you can pass that ID instead of frame number. You can find a good example in the Basic project template (look into phaser/ressources/basic), especially MainMenu.js Link to comment Share on other sites More sharing options...
sergil Posted November 19, 2013 Author Share Posted November 19, 2013 Wow!!!! I will test this!!! thanks a lot! Link to comment Share on other sites More sharing options...
Recommended Posts