Jump to content

Problem with a tween into a extended Sprite


Recommended Posts

Hi there,

so I have this object extending the Phaser Sprite... everything is working perfectly, the movement, the physics... everthing... BUT I added a tween to move the object and actually the tween is working perfectly, but the onLoop event is not firing (neither the onStart) and I don´t know why... and the tween, even the loop is working perfectly :blink:


Here´s the code:

Bear = function (game, posX, posY, time, root) {    Phaser.Sprite.call(this, game, posX, posY, 'bear-1');    var bear = this;        var mytween = this.game.add.tween(this).to({ y: posY-50 }, time*4, Phaser.Easing.Quintic.Out)    .to({ y: posY }, time*2, Phaser.Easing.Sinusoidal.In)    .loop()    //.yoyo()    .start();    mytween.onStart.add(function(){        alert("starting")    },this);    mytween.onLoop.add(function(){        console.log("Looooop, bitch!")    },this)};

Does anyone know what is happening? Thanks in advance.

Link to comment
Share on other sites


  • Recently Browsing   0 members

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