How does it work?
Every SceneState has an ArrayList of weather effects. The effects are loaded from the scene file and are declared like this: weather = Overlay,0,0,0,0.6
weather = Rain,-0.1,1.5,2
weather = Thunder,5000,0.5
The effects will be updated and rendered in this sequence. The first effect is the Overlay effect, this will draw a color on top of the scene. In this case it’s a semi-transparent black.
The second effect is the rain effect, the rain has an speed of -0.1 along the x-axis and a 1.5 along the y-axis. There are two drops per 100x100px.
And the last weather effect is thunder. This will show a flash which slowly fades away. In this case a new flash will appear after ~5sec (5000 ms).
To make sure the weather isn’t moving with you it gets the Camera class passed with every update which contains the changes along the x and y-axis.