How to code a Shockwave Effect

Started by
4 comments, last by TheAdmiral 16 years, 11 months ago
There are various points in my game where it would look cool to have a shockwave. (Like when a building blows up) So right now, I just have: g.setColor(shockWaveColor) g.drawOval(x-radius,y-radius,2*radius,2*radius) where the radius is increasing from '0' and it looks crappy. Can someone describe to me, or link to me, a method of coding a cool looking shockwave? Thanks
Advertisement
One fairly easy method is to just draw a single textured quad, which expands over time. You can also color it to be a specific color in-game. The most important part is that you get a texture that shows a circular shape, with some noise and texture in it so that it actually looks interesting.

You can also add particle effects and what have you, to spice things up.
My game is in 2D and I'm using Java. I'm not really sure how I would texture a quad or even create it.
Draw a shockwave in a paint program and draw that picture in your game.

That will probably need transparency/alpha blending and maybe scaling, though.
I want to do it with code instead of an image, because in image would cost a lot of cpu power to scale.
I'm not so sure that a single textured quad would look terribly convincing, but it would certainly be much faster than rendering a sphere, provided you're taking advantage of 3D hardware.

Admiral
Ring3 Circus - Diary of a programmer, journal of a hacker.

This topic is closed to new replies.

Advertisement