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

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.

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.


  • Recently Browsing   0 members

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