Module: SimpleRain 1.2, by SSH
The rain in games falls mainly on the overlay...
Download SimpleRain as a zip file
Author
Andrew MacCormack (SSH)
Please use the PM function on the AGS forums to contact
me about problems with this module
Abstract
Rain, without using a plugin
Dependencies
AGS 2.71Final2 or later
Functions
function SimpleRain.Init(int view);
Prepares some Rainfield sprites to use, using the sprites in view as Rain.
Ideally, this should be run in a room that is wider than the screen, or
when there is any wind at all, the Rain will look odd.
function SimpleRain.Go(optional int fastforward);
Starts Raining. If fastforward is set, it effectively runs the first
number of game cycles very fast to make the rain fill the screen as if it
was already raining, rather than had just started. Typically a setting of
20 to 40 works here.
function SimpleRain.No();
Stops Raining
function SimpleRain.SetWind(int wind);
Sets wind speed and direction.
Configuration
Fiddle about with the #defines here to change Rain, but its not an
exact science
Example
int wind;
function room_a() {
// Room script: after room fadein
SimpleRain.Init(RainFLAKES);
wind=0;
SimpleRain.Go();
SetTimer(1, 40);
}
function room_b() {
// Room script: repeatedly execute
if (IsTimerExpired(1)) {
if (Random(1)) { if (wind<8) wind++; else wind=1; }
else { if (wind>-8) wind--; else wind=-1; }
SimpleRain.SetWind(wind);
SetTimer(1, 40);
}
}
Caveats
No transparency
Rain movement sucks
Lots of overlays is slow
Revision history
20 Jan 06 v1.00 Initial version, modified from SimpleSnow
6 Dec 07 v1.10 Made it work with AGS 2.72
17 Jan 08 v1.20 Added fastforward option to SimpleRain.Go
Licence
SimpleRain AGS script module
Copyright (C) 2006, 2007 Andrew MacCormack
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
In addition to the licences mentioned in the modules themselves, you may choose to use the following creative commons licence if you prefer for all AGS modules and open source code resources on my site.

This work is licenced under a Creative Commons Licence.