Jirka1111 Posted August 25, 2014 Share Posted August 25, 2014 Is using atlas instead of sprites a good approach? I have 6 sprites, but if I use Appgyver Steroids, framerate is really low and I think after I add some ads stripe it's gona be very laggy. Link to comment Share on other sites More sharing options...
rich Posted August 25, 2014 Share Posted August 25, 2014 Yes always use an atlas as long as it's not too big (image dimensions, not file size) Link to comment Share on other sites More sharing options...
Jirka1111 Posted August 25, 2014 Author Share Posted August 25, 2014 So should I use it even for preload bar? Link to comment Share on other sites More sharing options...
rich Posted August 25, 2014 Share Posted August 25, 2014 No because you need that to be available before the rest of your game assets are. If the preload bar is part of the same image the game sprites are in, you can't show it until they've all loaded. Which kind of defeats the purpose of a loading bar. Link to comment Share on other sites More sharing options...
Jirka1111 Posted August 25, 2014 Author Share Posted August 25, 2014 Yeah, that's right What if I need to change my character sprite? Do I have to use kill() function and then game.add.sprite? EDIT: Cannot set frameName: bird.png? What the hell? Name is the same... Preloader: this.load.atlas('atlas', 'images/atlas.png', 'images/atlas.json'); Main state: Bird.bird = this.add.sprite(Bird.GAME_WIDTH/3, Bird.GAME_HEIGHT/2, 'atlas');Bird.bird.frameName = 'bird.png'; Link to comment Share on other sites More sharing options...
lewster32 Posted August 25, 2014 Share Posted August 25, 2014 Try just 'bird' for the framename. Some tools strip the file extension from the frame names. Link to comment Share on other sites More sharing options...
Jirka1111 Posted August 25, 2014 Author Share Posted August 25, 2014 Actually I opened JSON file and there was bird.png. I use TexturePacker. Shoul I use JSON Array or JSON hash? Link to comment Share on other sites More sharing options...
CtlAltDel Posted August 25, 2014 Share Posted August 25, 2014 this.add.sprite(Bird.GAME_WIDTH/3, Bird.GAME_HEIGHT/2, 'atlas', 'bird.png'); it should work if your json is ok. Link to comment Share on other sites More sharing options...
Jirka1111 Posted August 25, 2014 Author Share Posted August 25, 2014 Thank you, that really works :-) But my fault was using JSON Hash instead of Array. Somebody should wrote it to proper example. Link to comment Share on other sites More sharing options...
Recommended Posts