ylluminarious Posted March 20, 2015 Share Posted March 20, 2015 Hi all, I'm working with something concerning this Phaser example: http://phaser.io/examples/v2/animation/animation-events. Unfortunately, I'm having some problems with what I'm trying to do because of what seems to be implicit passing of arguments to the methods `animationStarted`, `animationLooped`, and `animationStopped`. For example: How does this method:function animationStarted(sprite, animation) { game.add.text(32, 32, 'Animation started', { fill: 'white' });} Get its arguments when it's called like so?:anim.onStart.add(animationStarted, this); This may just be something with JavaScript that I've looked over or something internal with Phaser, but I'd like to know how this "implicit" passing of arguments works. Thanks in advance Link to comment Share on other sites More sharing options...
rich Posted March 20, 2015 Share Posted March 20, 2015 It's a Signal - if you look in the Animation class you'll see when it's dispatched and which parameters it sends with it. Link to comment Share on other sites More sharing options...
ylluminarious Posted March 20, 2015 Author Share Posted March 20, 2015 Ah, ok. I think I see what you mean. I saw a number of `dispatch` methods in the Animation class for the `onStart`, `onLoop`, and `onComplete` methods and they have arguments like `this._parent`, which must be the sprite, and `this`, which must be the animation. That makes sense. Thanks again! Link to comment Share on other sites More sharing options...
Recommended Posts