Step 3: Raindrop Movement

To make the rain fall down, simply add to the Y position. Each Raindrop will fall at the same rate of 10 pixels per frame. To create the illusion if wind, simply add to the X position. A random value will make the movement appear more natural, in our case 4+Random(4), a random number between 4 and 7.
When a Raindrop is overlapping an obstacle, a Splash object is created and the Raindrop is then repositioned back in the sky. No raindrops are ever destroyed, the existing ones are simply recycled.
Once again, the X position is set to a random value within 100 pixels left of the frame and 420 right of that. Now, we could set the Y position to 0, but this would cause our raindrops to synchronize into lines, as shown below.


This is because each Raindrop falls 10 pixels per frame and any Raindrop objects within 10 pixels (vertical) of each other will cross over onto the obstacle at the same time (during the same frame). If their Y position was then set to 0, each of these raindrops, which were previously falling from different heights, would now be falling from the same height. Positioning each at a random Y co-ordinate between -9 and 0 will fix the problem.
5