Jump to content

can i use a atlas for the whole game?


Recommended Posts

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

Link to comment
Share on other sites

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

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...