espace Posted May 26, 2017 Share Posted May 26, 2017 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 More sharing options...
Nesh108 Posted May 27, 2017 Share Posted May 27, 2017 Hey @espace3d, what's the actual problem? We need more info than just "that don't work". Link to comment Share on other sites More sharing options...
espace Posted May 29, 2017 Author Share Posted May 29, 2017 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 More sharing options...
Abhishek Singhal Posted May 29, 2017 Share Posted May 29, 2017 @espace3d, can you share the piece of code that is being problematic ? Link to comment Share on other sites More sharing options...
Abhishek Singhal Posted May 29, 2017 Share Posted May 29, 2017 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 More sharing options...
Recommended Posts