SFML community forums

Help => Graphics => Topic started by: Dummie on March 19, 2008, 04:30:01 pm

Title: Explosions? How?
Post by: Dummie on March 19, 2008, 04:30:01 pm
Hey,

How would be a nice explosion done in SFML?

I tried to display a explosion from a bitmap but the problem is the backgroundcolor. And isnt it very bad if I have to create for every underground a new explosion, just because of different backgrounds?

Colorkeying doesn't help at all, too.  I get very ugly corners and so on.

Is there a way to draw a explosion with some particles without bitmaps or has somebody else created a nice explosion that does display on every background fine?
Unfortunately I haven't experience with OpenGL so I would need to keep on be in 2D.

Thanks in advance :)

PS: This isn't a real problem with SFML graphics, so maybe wrong forum. But I thought its a good place to ask on the SFML webpage :) :D  :P
Title: Explosions? How?
Post by: elisee on March 19, 2008, 05:09:51 pm
Just draw it in PNG instead of BMP. I did mine with vector graphics and then got it converted in PNG.
Title: Explosions? How?
Post by: Laurent on March 20, 2008, 02:27:47 am
Yes, you just need to get an explosion image which has a proper alpha chanel, so that it blends nicely with the background.

You can also create a particle system, but it will be much harder and longer to do ;)
Title: Explosions? How?
Post by: Dummie on March 20, 2008, 05:18:36 pm
Thanks for the answers :) I tried GIMP to create an image with an alpha channel and I got it working after some tries :)

The last problem is to find a nice image of an explosion that uses an alpha channel :) The best would be an animation :) Does anybody know a program which can create explosions? Of course, it's needed that the program save it with an alpha channel. Unfortunately I just found programs without alpha channel...

Thanks a lot :)
Title: Explosions? How?
Post by: Dummie on March 20, 2008, 07:41:06 pm
Hey guys,

I have a good and a bad message. I still haven't found a explosion generator. But I found a explosion image with alpha channel.
I tried it in my program and it works just perfect.

Then I tried to show more then just one explosion and I was very sad that the whole program became very slow. Then I turned the "release mode" on and I saw such a speed. It's amazing. Thanks for SFML :)

Here you can look at my result, but please note that the image I used(except the control image) aren't my own:
The source code is also included.
http://www.2shared.com/file/3018221/a461a29f/Explosions.html

To spawn a explosion simply press with the mouse somewhere.

I'd like to hear criticism and ideas how I could make it better :)

Thanks in advance.