Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question
    
I couldn't help my self but to ask if you going to create super slim soccer clone? –  Ali.S May 29 '12 at 15:28
    
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? –  Ali.S May 29 '12 at 15:30
    
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! –  Stephen May 29 '12 at 15:51
    
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? –  Ali.S May 29 '12 at 15:57
    
I tried doing it both ways but I guess I don't know which alpha blending mode to use! –  Stephen May 29 '12 at 16:02
add comment

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
    
So are you saying to draw 2 separate ball objects? –  Stephen May 29 '12 at 16:22
    
yep, but the later one is not fully opaque, like the first one. –  Ali.S May 29 '12 at 16:32
    
Thanks that really helps –  Stephen May 29 '12 at 16:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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