I'm currently working on a tile-based game in Java2D, and I was thinking of adding some cheap eye candy.
For example, implementing a simple particle system (maybe something like this) for explosions and/or smoke.
Do you have any suggestion for relatively easy to program effects that wouldn't require drawing a lot (or at all) of new art?
Tutorials and code samples for said effects would also be most welcome!
-Ido.
PS - if absolutely necessary I could switch to something like LWJGL/JOGL or even Slick - but I rather stay with Java2D.
Implementing blurs and other image filtering effects are fairly simple to perform.
For example, to perform a blur on a BufferedImage
, one can use the ConvolveOp
with a convolution matrix specified in a Kernel
:
BufferedImageOp op = new ConvolveOp(new Kernel(3, 3,
new float[] {
1/9f, 1/9f, 1/9f,
1/9f, 1/9f, 1/9f,
1/9f, 1/9f, 1/9f
}
));
BufferedImage resultImg = op.filter(originalImg, resultImage);
Not quite sure when a blur effect is needed, but it may come in handy some time. But I'd say it's a low-hanging fruit for its ease of implementation.
Here's some information on convolution matrices. It can be used to implement effects such as sharpen, emboss, edge enhance as well.