Jump to content

Atlas breaking everything!


Recommended Posts

I've just tried exchanging my spritesheet for an atlas, but have found that after using an atlas the sprites load properly, but none of my functions seem to be defined?




 game.load.spritesheet('rabbit', 'assets/rabbit_jump.png', 87, 144);
 game.load.atlasXML('rabbit', 'assets/rabbit_atlas.png', 'assets/rabbit_atlas.xml');

There are no errors showing whatsoever, but when I try to execute any function from the console it's always getting undefined. Here's my XML:


<TextureAtlas imagePath="sprites">   <SubTexture name="EyesClosed" x="87" y="0" width="85" height="129"/>   <SubTexture name="fall" x="174" y="0" width="79" height="132"/>   <SubTexture name="jump" x="255" y="0" width="78" height="143"/>   <SubTexture name="stand" x="0" y="0" width="85" height="129"/></TextureAtlas>

And here's my rabbit sprite:


    player = game.add.sprite(worldX, game.world.height - 340, 'rabbit');    game.physics.arcade.enable(player);    player.body.gravity.y = 1150;    player.anchor.setTo(0.5,0);    player.animations.add('stand', [0]);


Anyone had this happen to them before? I'm kind of baffled as to why this would be happening...






Ok looks like I was being stupid, functions are working but it seems like this is causing the problem:


    clickLayer = game.add.sprite(worldX, worldY, 'click');    clickLayer.anchor.setTo(0.5);    clickLayer.scale.setTo(4,4);    clickLayer.alpha = 0;    clickLayer.fixedToCamera = true;    clickLayer.inputEnabled = true;    clickLayer.events.onInputDown.add(jump);

It doesn't look like anything is receiving input with  'events.onInputDown.add()'. Weird that this is only happening with an atlas....

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...