I have a fire particle emitter in my project and I have it following a football. My goal is to make the football look like it is on fire but the problem is when I add it to the screen it can only be in front of the football or behind it. I want to be able to add it to the screen and make it transparent so that the football will still show through to a certain point. Does anyone now how I would go about doing this?

  • \$\begingroup\$ I couldn't help my self but to ask if you going to create super slim soccer clone? \$\endgroup\$ – Ali1S232 May 29 '12 at 15:28
  • \$\begingroup\$ and besides I really don't get what the problem is, I mean what's wrong with drawing too many sprites with same texture attached to an spritebatchnode? \$\endgroup\$ – Ali1S232 May 29 '12 at 15:30
  • \$\begingroup\$ I am trying to add the particle emitter in front of the football and there for it completely covers it. So I want to be able to make the emitter transparent or something so that the football sprite shows through! \$\endgroup\$ – Stephen May 29 '12 at 15:51
  • \$\begingroup\$ so you mean particles don't alpha blend like other stuff? and besides why don't you put the ball in front of those particles? \$\endgroup\$ – Ali1S232 May 29 '12 at 15:57
  • \$\begingroup\$ I tried doing it both ways but I guess I don't know which alpha blending mode to use! \$\endgroup\$ – Stephen May 29 '12 at 16:02

I would go with this method:

  1. draw the ball object,
  2. then draw the particles over it with alpha blending enabled
  3. redraw the ball in exact same position but this time use lower opacity for the whole sprite (maybe something around 40%)

This way you'll both see the ball everywhere even if no particles are drawn at that pixel(caused by the back ball picture), and you can always see the ball.

And for blending method just use the normal function implemented by default.

  • \$\begingroup\$ So are you saying to draw 2 separate ball objects? \$\endgroup\$ – Stephen May 29 '12 at 16:22
  • \$\begingroup\$ yep, but the later one is not fully opaque, like the first one. \$\endgroup\$ – Ali1S232 May 29 '12 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.