Jump to content

My sprite sheet has strange behaviour


QuentinIcky
 Share

Recommended Posts

Hi all ! 

As the title said, I have a sprite sheet who has a strange behaviour. It's difficult to explain so you can see the uploaded file to see.

I add my sprite sheet like this inside the preload() :

 

level2.load.spritesheet('hil', 'dest/img/sprite-Level2.png', 373, 265, 8);

In the create() : 
 

player = level2.add.sprite(380, level2.height - 430, 'hil', 1);
player.frame = 0;
player.enableBody = true;
player.scale.setTo(0.5);
player.animations.add('left', [0,1,2,3,4,5,6,7,8], 5, true);

And in the update() :

if (cursors.left.isDown) {
    player.body.velocity.x = -800;
    player.animations.play('left');

}


I searched a lot but I didn't find anything to help me. I can't understand why it doesn't work. 
If somebody knowes, it could be very helpfull.

Thanks by advance.

spritesheet.mov

Link to comment
Share on other sites

So I'm not quite sure exactly what behavior you are referring to. Would I be correct in assuming that you're referring to how to character is coming into, then leaving the sprite? If so, I'm fairly confident that it's an issue with your sprite sheet and not your code.

If that's not a correct assumption, would mind narrowing down to the problem you're concerned about?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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