Jump to content

problem with sprite animation


Luiz Bills
 Share

Recommended Posts

This is my code...

function preload() {    game.load.tilemap('level1', 'assets/rpgtiles.png', 'assets/rpg.json', null, Phaser.Tilemap.JSON);    game.load.spritesheet('sprites', 'assets/rpgtiles.png', 32, 32, -1);    // loaded assets without errors}var map,    player;function create() {    game.stage.backgroundColor = '#8888ff';    map = game.add.tilemap(0, 0, 'level1');    player = game.add.sprite(0, 0, 'sprites', 72);    player.body.collideWorldBounds = true;    player.animations.add('down', [72, 73], 10, true); // Uncaught TypeError: Cannot read property 'uuid' of null }

the spritesheet: https://docs.google.com/file/d/0B1W35LiKlq11WEV6QTNzbmd4Ylk/edit?usp=sharing

Link to comment
Share on other sites

  • 2 years later...

Thanks for this, i was going crazy about uncaught error and the reason was i was not defining max frames.

 

game.load.spritesheet('sprites', 'assets/rpgtiles.png', 32, 32, -1);

Change the -1 to the max number of frames in your spritesheet.  Right now you have -1 max frames.   ;)

 

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.

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

Loading...
 Share

  • Recently Browsing   0 members

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