User Tag List

Results 1 to 2 of 2

Thread: Rain

  1. #1
    Lynel
    ZC Developer
    pkmnfrk's Avatar
    Join Date
    Jan 2004
    Location
    Toronto
    Age
    37
    Posts
    1,248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    3,142
    Level
    18
    vBActivity - Bars
    Lv. Percent
    10.54%

    Rain

    To prove that I'm not all washed up, here's something wetter than normal:

    Code:
    int rain_drops[600];
    ffc script Rain {
    	void run(int density, int col, int lay) {
    		
    		init(density);
    		
    		for(int i = 0; i < 200; i++) {
    			update(density);
    		}
    		
    		while(true) {
    			update(density);
    			draw(density, col, lay);
    			Waitframe();
    		}
    		
    	}
    	
    	void init(int density) {
    		for(int i = 0; i < 3 * density; i+=3) {
    			rain_drops[i] = Rand(256);      //x position
    			rain_drops[i + 1] = 0;          //y position
    			rain_drops[i + 2] = Rand(176);  //"z" (actually y termination)
    		}
    	}
    	
    	void update(int density) {
    		for(int i = 0; i < 3 * density; i+=3) {
    			if(rain_drops[i + 2] == -1) {
    				rain_drops[i] = Rand(256);
    				rain_drops[i + 1] = 0;
    				rain_drops[i + 2] = Rand(176);
    			} else if(rain_drops[i + 1] >= rain_drops[i + 2]) {
    				rain_drops[i + 2] = -1;
    			} else {
    				rain_drops[i + 1] += 2;
    			}
    		}
    	}
    	
    	void draw(int density, int col, int lay) {
    		for(int i = 0; i < 3 * density; i+=3) {
    			if(rain_drops[i + 2] == -1) {
    				Screen->Line(lay, rain_drops[i] - 1, rain_drops[i + 1] - 1, rain_drops[i] - 2, rain_drops[i + 1] - 2, col, 1, 0, 0, 0, 128);
    				Screen->Line(lay, rain_drops[i] + 1, rain_drops[i + 1] - 1, rain_drops[i] + 2, rain_drops[i + 1] - 2, col, 1, 0, 0, 0, 128);
    			} else {
    				Screen->Line(lay, rain_drops[i], rain_drops[i + 1], rain_drops[i], rain_drops[i + 1] + 1, col, 1, 0, 0, 0, 128);
    			}
    		}
    	}
    }
    - D0: density of rain. The higher this number, the more rain drops there will be on screen (and the more lag, etc). Max is 200, but if you're brave, you can increase the size of that array and add more (the array must be at least 3 times the number of rain drops you want)
    - D1: colour. Looks best with white drops, which is usually palette entry #1.
    - D2: layer. Probably looks best on Layer 5 or 6, so that it appears on top of everything.

    Combine with the Lightning script and suitable music for maximum effect.
    Tale of the Cave - a web comic - Updates Monday, Wednesday, Friday
    ZC Tutorials - Tutorials and Script Library - Updated July 30, 2008
    ZeldaGuard - Corruption in my save files? It's more likely than you think!
    I do script requests!

  2. #2
    Octorok Archangel's Avatar
    Join Date
    Apr 2008
    Age
    34
    Posts
    362
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    vBActivity - Stats
    Points
    1,732
    Level
    13
    vBActivity - Bars
    Lv. Percent
    94.76%

    Re: Rain

    Nice, I can use this in the intro for my current quest which needs a sad atmosphere.

    On a related note, I figured out a way to fix armos2 script of yours. Change it to an look alike armos combo that is a normal combo and cycles to the next combo when the armos is fully activated. Just come up with the timing right, and it should work.
    -Archangel-
    Keeping the ZC Developers busy with heavy beta testing skills and experimentation is what I do best. May ZC be bug free!

    You should seriously check advmath.zh out if you use ZC.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social