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


  • Recently Browsing   0 members

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