Jump to content

What appears to be implicit passing of arguments to a function


Recommended Posts

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


  • Recently Browsing   0 members

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