nak3ddogs Posted October 23, 2014 Share Posted October 23, 2014 hi! i would minimalize my game. the atlas and tinypng look like the best solution for it. can i use 1 atlas for all sprite?and how can i use it? function preload() { game.load.atlas('sprites', 'assets/sprites.png', 'assets/sprites.js');} function create() { game.bg = this.game.add.tileSprite(0,0, 800 ,480, 'sprites', 'container.png'); game.bg.autoScroll(-20,0); game.bg.fixedToCamera = true; player = game.add.sprite( 48, game.world.height, 'sprites.png');}it wont work for me pls help Sam 1 Link to comment Share on other sites More sharing options...
fhefh Posted October 23, 2014 Share Posted October 23, 2014 i see you use the titleSprite, preload(){...this.game.load.tilemap('map', 'assets/map.json', null, Phaser.Tilemap.TILED_JSON);...} create() {...this.map = this.game.add.tilemap('map');....} Link to comment Share on other sites More sharing options...
nak3ddogs Posted October 23, 2014 Author Share Posted October 23, 2014 i use tilemap but its different. i would use atlas for sprites and images. tilesprite only for background. Link to comment Share on other sites More sharing options...
fhefh Posted October 23, 2014 Share Posted October 23, 2014 // Load atlasthis.game.load.atlas('player', 'assets/player.png', 'assets/images/player.json');// Sprite creationthis.game.add.sprite(0, 0, "player"); i use texturepacker make the player.json Link to comment Share on other sites More sharing options...
nak3ddogs Posted October 24, 2014 Author Share Posted October 24, 2014 the question is can i use a atlas for more sprite? when yes how can i do it, i could use atlas only for 1 sprite Link to comment Share on other sites More sharing options...
valueerror Posted October 24, 2014 Share Posted October 24, 2014 short answer: YES you can use one big atlas for all your sprites, tilesprites, images, buttons, animations ...player = this.game.add.sprite(100,100,, 'sprites', 'player.png'); button=game.add.button(x, y, 'sprites', function(){ }, this, 'button-inactive.png', 'button-active.png', 'button-active.png.png'); Link to comment Share on other sites More sharing options...
nak3ddogs Posted October 24, 2014 Author Share Posted October 24, 2014 ty for straight answer.can u help me pls, when i use shoebox what is the ideal export option?is this the method for load the atlas in preload?game.load.atlas('sprites', 'assets/sprites.png', 'assets/sprites.js'); Link to comment Share on other sites More sharing options...
nak3ddogs Posted October 24, 2014 Author Share Posted October 24, 2014 ty. solved. i use starling xml Link to comment Share on other sites More sharing options...
valueerror Posted October 24, 2014 Share Posted October 24, 2014 xml is also possible? nice.. i always used json array.. so one more thread to mark solved Link to comment Share on other sites More sharing options...
Recommended Posts