Jump to content

Phaser 2.0.7 available for testing


rich
 Share

Recommended Posts

I think there's a bug in 2.0.6-7

I've been using 2.0.4; tried 2.0.6 

Something happen to 'animation.frame' property once an animation completed playing.

I debug the animation.frame. It works fine if I set loop to true in the play method.

But when loop is set to false, once the animation complete the animation.frame throw an error "can't read property index of undefine.".

I noted that other property ie. animation.isPlaying is still working. And once I restarted the animation the frame property comes back.

I don't think that's the behavior you-we want. Since we might want to access the frame property when the animation isn't playing - I tested the animation.stop() method, it works fine. 
 

var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update ,render:render});    var anim;    function preload() {        game.load.atlasJSONHash('stunOne', 'img/stunOne/stunOne.png', 'img/stunOne/stunOne.json');    }    function create() {        var stunOne = game.add.sprite(400,400,'stunOne');                anim = stunOne.animations.add('stun');        anim.setFrame(0,true);        anim.play(14);        game.time.events.add(Phaser.Timer.SECOND*4,function(){            anim.play(14);        },this);    }    function update() {}    function render()    {        game.debug.text("animObject:" + anim.isPlaying, 32, 45);        game.debug.text("frame:" + anim.frame, 32, 60);          if(anim.isPlaying)        {            game.debug.text("frame:" + anim.frame, 32, 60);            }    }
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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