Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Program Announcements / Very simple 2D Effects Examples (Rain, Thunder, Clouds, Flashlight)

Author
Message
19081980
14
Years of Service
User Offline
Joined: 22nd Oct 2009
Location:
Posted: 23rd Apr 2010 18:20
Hi!
Here is an example how to achieve very simple 2D weather effects based on images.
You are free to use parts of the example for your own project if you like to.

I am sure there are a lot of better, faster, more professional ways to get 2D effects like this but I wanted to make it as simple as possible (for me) so you are able to totally change the effects by simply modify the images (or load different images).

If you have some basic Darkbasic skills and some basic Photoshop skills you will easily be able to understand and modify the code and/or the images/sprites.


I made these effects for a 2D top down shooter I have been programming. But I am not sure if I will ever finish the project so I decided to offer you some of my code and images. Maybe some of you get inspired or might need stuff like that.

If you want similar effects at a different screen resolution than 1024*768 you will have to recreate the images and modify the sourcecode.
This example only works fine with 1024*768. The application will change the resolution for you.

What is inside?

Rain Effect
There are 3 (1024*768 sized) images scrolling down in a infinite loop.
Snow Effect
There are 3 (1024*768 sized) images scrolling down in a infinite loop.
Clouds Effect
There are 3 (1024*768 sized) images scrolling left or right in a infinite loop.
Thunder Effect
A yellow JPG image will flash for a second and it's alpha channel gets reduced until it is invisible.
In addition to that a flash sprite will appear on a random screen position in a random angle.
Night Effect
A semi transparent black (1024*768 sized) PNG image overlays the screen
Flashlight Effect
A simple (cheap) flashlight effect.
If you press "F" on your keyboard and it is night instead of the black PNG image a black PNG image with a lightray cut out will overlay the screen.
The black PNG overlay will rotate and move according to the player character.
This gives a nice flashlight effect to your 2D game. Of course there are now shadows or more professional stuff.

Some screenshots





Notes
The effects mainly base on simple semi-transparent PNG images. Big sized. So this is not a very fast solution.
The project contains some sprites from Reiner's Tileset (reinerstileset.4players.de)
The effect images were created by me and some of them based on free Photoshop brushes.
The sounds are from freesounds.org

I hope it works on your computers as it works on mine. I got Windows 7/32 OS.
If you use the code in any of your projects you will probably have to change the sprite, image, sound numbers in the sourcecode to fit your demands.

Downloads
A compiled example exe with all effects is attached to this message (2DWeather.exe ... about 18 MB compressed).

WinRar archive of sourcecode, images and sounds:
http://rapidshare.com/files/379235224/source.rar
(let me know if something is missing or the link won't work)

I know the best looking "2D" games are done in 3D and the effect are made with shaders. But I had a lot of fun with "pure 2D" and wanted to own some weather effects to bring some atmosphere.
Unfortunately this solution needs some disk space because of the big images. But with some changes you could just load single smaller sprites instead of the 1024*768 images.


Best regards from Germany

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-04-18 23:42:40
Your offset time is: 2024-04-18 23:42:40