Jump to content

Documentation


ema99
 Share

Recommended Posts

Hi all
 
 
i am newbie on framework pasher for html5. i like phaser but not found documentation about their class. 
 
for example i  found this following problem and i know not how to  functioned
 
function preload() {
 
 
game.load.atlasJSONHash('pj', 'img/running_bot.png', 'index/running_pj.json');
}
 
function create() {
 
pj = game.add.sprite(game.world.centerX, game.world.centerY, 'pj');
 
pj.animations.add('up');
 
pj.animations.play('up',['run00', 'run01', 'run02', 'run03', 'run04', 'run05', 'run06', 'run07', 'run08', 'run09', 'run10'] ,10, true, false);
 
pj.scale.x += 0.6;
 
pj.scale.y += 0.6;
 
 
 
}
 
 
the sprite is displayed but not animated
 
 
Sorry for my bad english,
 
thanks

 

Link to comment
Share on other sites

No 100% sure, but I think you want to add your run animation, then play it. Like so:

function create() {  pj = game.add.sprite(game.world.centerX, game.world.centerY, 'pj');//add the animation  pj.animations.add('up',['run00', 'run01', 'run02', 'run03', 'run04', 'run05', 'run06', 'run07', 'run08', 'run09', 'run10'] ,10, true, false);//play it  pj.animations.play('up');    pj.scale.x += 0.6;  pj.scale.y += 0.6;}
Link to comment
Share on other sites

 

hi meanderinglea thanks for your comment
 

 

now i see this in javascript console:

 

 

Uncaught TypeError: Cannot read property 'uuid' of null

 

 

try using:

pj.animations.add('up',[0,1,2,3,4,5], 10, true, false);

 

ran into this myself, was because i was using an array in the textureAtlas json instead of a hash.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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