TGC Codebase Backup



Overhead Rainfall Effect by Trek

8th Jan 2006 16:07
Summary

3D Rainfall effect from an overhead view



Description

This is a rain effect for games with an overhead camera view. It was programmed by a friend of mine and looked so good that I offered to post it on here for him. You could either just stick the stuff between "Do...loop" in your main loop, or, to do it a more sophisticated way, convert it to a function.

To download more great productions from my amateur software company, Trek Software, check out my website at http://roborangers.home.comcast.net/Trek.html



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    frequency = 3

color backdrop rgb(0,0,0)

autocam off
position camera 0,20,0
point camera 0,0,0

DO
    inc x,1
    if x = frequency
        z = rnd(149)+1
        if object exist(z)=0
            make object plain z,1,0.03
        endif
        color object z,rgb(0,0,150)
        set object to camera orientation z
        zrotate object z,90
        position object z,(camera position x()-10)+rnd(20),20,(camera position x()-10)+rnd(20)
        x = 0
    endif

    for y = 1 to 150
        if object exist(y)=1
            if object position y(y) > 0
                position object y,object position x(y),object position y(y)-0.5,object position z(y)
            endif
            if object position y(y) <= 0
                delete object y
            endif
        endif
    next y
loop