Jump to content

Problem with Tweens


totallybueno
 Share

Recommended Posts

Hi there, I´m having some problems with tweens in my game... I have this code:

function doTween(object, property, value, delay, callback){            delay = typeof delay !== 'undefined' ? delay : 0;            callback = typeof callback !== 'undefined' ? callback : null;            var tween = game.add.tween(object);            if(property=="x"){                tween.to({x: value}, 500).easing(Phaser.Easing.Bounce.Out).delay(delay).onCompleteCallback(callback);            }else if(property=="y"){                tween.to({y: value}, 500).easing(Phaser.Easing.Bounce.Out).delay(delay).onCompleteCallback(callback);            }                        tween.start();        }

And that stuff is giving me this error on Firefox:

 

TypeError: tween.to(...).easing(...).delay(...).onCompleteCallback is not a function

 

Can someone explain me why? I don´t understand what´s happening... btw, I´m using Phaser v1.1.6

 

 

Thanks in advance guys.

Link to comment
Share on other sites

Thanks lessmilk_, I fixed that :)

 

Now, another question but I guess this is purely javascript, I´m receiving an error telling me that the parameter should be a function, and I´m receiving that function (or null) as a parameter, how should I write that line?

 

This one I have is not working... but I guess it´s just about js syntax.

function doTween(object, property, value, delay, callback){//code//     tween.to({x: value}, 500).easing(Phaser.Easing.Bounce.Out).delay(delay).onComplete.add(callback);}
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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