ema99 Posted September 14, 2013 Share Posted September 14, 2013 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 More sharing options...
meanderingleaf Posted September 14, 2013 Share Posted September 14, 2013 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 More sharing options...
ema99 Posted September 14, 2013 Author Share Posted September 14, 2013 hi meanderinglea thanks for your comment now i see this in javascript console: Uncaught TypeError: Cannot read property 'uuid' of null Link to comment Share on other sites More sharing options...
bryanwood Posted September 14, 2013 Share Posted September 14, 2013 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 More sharing options...
ema99 Posted September 14, 2013 Author Share Posted September 14, 2013 Ho thanks you bryan, its the solution. existing documentation online for phaser or are on creating? Link to comment Share on other sites More sharing options...
Travis Posted September 14, 2013 Share Posted September 14, 2013 according to the devs, the docs / API is currently a work in progress, but they're going to get it out ASAP Link to comment Share on other sites More sharing options...
rich Posted September 14, 2013 Share Posted September 14, 2013 Yes we're working on docs atm, and doing lots more examples too. Link to comment Share on other sites More sharing options...
Recommended Posts