2
\$\begingroup\$

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?

\$\endgroup\$
5
  • \$\begingroup\$ I couldn't help my self but to ask if you going to create super slim soccer clone? \$\endgroup\$
    – Ali1S232
    Commented May 29, 2012 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
    Commented May 29, 2012 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
    Commented May 29, 2012 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
    Commented May 29, 2012 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
    Commented May 29, 2012 at 16:02

1 Answer 1

2
\$\begingroup\$

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.

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .