ZoomBox Posted July 11, 2014 Share Posted July 11, 2014 Hello !I know it is possible for a sprite (with sprite.tint) but how can it be done with a particle ? I saw this: http://examples.phaser.io/_site/view_full.html?d=particles&f=particle+class.js&t=particle%20classBut I don't understand :-( Thank you in advance. Link to comment Share on other sites More sharing options...
lewster32 Posted July 11, 2014 Share Posted July 11, 2014 A particle is a type of sprite, and an emitter is a type of group, so if you can find the particle you want to tint in the emitter using the normal methods you can just call .tint on it as normal. Something like this will tint all the particles in the emitter:emitter.forEach(function(particle) { // tint every particle red particle.tint = 0xff0000;});See the Emitter documentation for more. Fenopiù and lukaMis 1 1 Link to comment Share on other sites More sharing options...
ZoomBox Posted July 11, 2014 Author Share Posted July 11, 2014 Thank you but in the Particle doc (http://docs.phaser.io/Phaser.Particle.html) there's no mention of "tint". Actually that's the first thing I checked. I will still try it but I'm not confident. Link to comment Share on other sites More sharing options...
lewster32 Posted July 11, 2014 Share Posted July 11, 2014 Phaser.Particle = function (game, x, y, key, frame) { Phaser.Sprite.call(this, game, x, y, key, frame);http://docs.phaser.io/Particle.js.html#sunlight-1-line-20 Particle extends Sprite (which itself inherits from pixi's Sprite, and so on) so it inherits all of Sprite's properties. ZoomBox and Fenopiù 2 Link to comment Share on other sites More sharing options...
ZoomBox Posted July 11, 2014 Author Share Posted July 11, 2014 Oh nice man, you're helpful :-) I didn't know Particle Extended Sprite.I'll try this now but I suppose it'll work. Edit: Fully functionnal, thank you <3 lewster32 1 Link to comment Share on other sites More sharing options...
Recommended Posts