Jump to content

searching to play an animation each time weapon.fire()


espace
 Share

Recommended Posts

hi,

i search for this feature in the doc with the method onFIre but i that don't work...

The onFire Signal is dispatched each time Weapon.fire is called, and a Bullet is successfully launched. The callback is set two arguments: a reference to the Weapon that fired the bullet, and a reference to the bullet sprite itself.

any suggestion ?

 

Link to comment
Share on other sites

hi Nesh108,

In fact i don't know how to use this special function "weapon.onFire()"

When i type this i receive no message error.

I would know when the weapon fire ? maybe with a boolean flag and after i could play an animation with an update function.

if i 'm not clear say me.

 

Link to comment
Share on other sites

What i get from the documentation is that : onFire is a signal being dispatched.
In Phaser we handle signal like this,

weapon.onFire.add(functionName);

function functionName(bullet, weapon){
        // here bullet is the reference of the image used for bullet and weapon holds the reference to object that triggered onFire event.
        console.log(bullet, weapon);
}

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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