Computer Science Canada Rain Code |
Author: | SNIPERDUDE [ Sat Oct 14, 2006 1:55 pm ] |
Post subject: | Rain Code |
For the game I'm making (rpg, birdseyeview) I want to make it look like it's raining for one of the sections. Because it's birdseyeview, the rain will look like its coming from the outer parts of the screen towards the centre. I don't know how to do this, and was wondering how. Please help. |
Author: | Cervantes [ Sat Oct 14, 2006 2:52 pm ] |
Post subject: | |
Moved from [Turing Source Code]. You'll need to be familiar with arrays and trig. Records would also be good. If you've got that, you'll need to write code that will generate a bunch of rain droplets all around the screen. All droplets will move slightly towards the centre, except those that are spawned exactly in the centre of the screen. Droplets spawned closer to the edge of the screen will move more than will rain droplets near the middle. The amount that they move will vary with the height of your view. When the droplet is first spawned, it should probably be drawn as a line with a certain length and as it falls, it's length diminishes, since we're looking more straight down on it and seeing less and less of its vertical speed. This won't be an easy thing to code. It'll take some thought. What are your thoughts? |
Author: | Tony [ Sat Oct 14, 2006 3:00 pm ] |
Post subject: | |
you just need a good reference for an image. The one linked is from opposite perspective (on the ground, looking up), though really the only difference is the direction the lines will be moving in the animation. |
Author: | Flikerator [ Sat Oct 14, 2006 4:03 pm ] | ||
Post subject: | |||
I decided to make an example; but I have a very basic problem; the angle (in radians or degrees; doesnt matter) from the starting of the rain to the center. I was then going to make it so it doens't go for the exact center but around there, and then when it gets close delete that piece of rain. I just need the angle. I basically have the slope, but it doesn't seem to work. I might be making a mistake though somewhere else though. I assumed the slope would be the same as the angle in radians, but that doesn't seem to be the case ^^; Here it is anyways;
|
Author: | R.G. [ Fri Oct 27, 2006 6:05 am ] |
Post subject: | |
wow tht looks coool! |
Author: | Windsurfer [ Fri Oct 27, 2006 8:33 pm ] |
Post subject: | |
Ooookay. doesn't really look like rain to me, yet. I'll see if i can figure something out. |
Author: | Windsurfer [ Sat Oct 28, 2006 5:49 pm ] | ||
Post subject: | |||
well, here's my rain. I hope you like it. I was thinking of combining it with my sparkle program for some splashing... hm, in a bit. To be honest, i know it's not mathematical. I know it's more like me taking previous code and tweaking some variables. But it works, and i think that's what counts ![]() I combined two of my programs together here, my sparkle engine, and my stars program.
|
Author: | Windsurfer [ Sun Oct 29, 2006 7:38 pm ] |
Post subject: | |
What? That's a really cool effect up there. Has no one tried it? What do people think? Common people, i put a good hour of work into that ![]() |
Author: | razrdude [ Sun Oct 29, 2006 7:39 pm ] |
Post subject: | |
Windsurfer that looks awesome, ^^ also the disperse when it hits the ground is amazing. lol @ Flikerator good job too, but it looks like bugs crawling. ![]() |
Author: | [Gandalf] [ Sun Oct 29, 2006 8:50 pm ] | ||
Post subject: | |||
Windsurfer wrote: What? That's a really cool effect up there. Has no one tried it? What do people think? Common people, i put a good hour of work into that
![]() T'is quite nice, the splash effect especially. ![]() Though it pains me to see such code:
Why do you have the x and y maximums hardcoded? It doesn't look as nice when you're at 1024x768, with the scrollbars distracting you and things being drawn where you can't see them. Why do you have 6 different screen-setting procedures? Why are you mixing "setscreen" with "View.Set"? |
Author: | richcash [ Tue Oct 31, 2006 11:07 pm ] | ||
Post subject: | |||
Yeah Windsurfer, that is AMAZING! ![]() Here's some basic rain I made using some OOP that should be easy to read and understand. It doesn't splash, and it doesn't look great, but it's easy to work with and you can try to put your own splash in later on.
[Ask me to comment it if necessary!] |
Author: | ericfourfour [ Sun Nov 05, 2006 12:58 am ] |
Post subject: | |
Here is my version of the rain system. Scroll down to the 3rd post to find it. |
Author: | SNIPERDUDE [ Tue Nov 07, 2006 9:27 pm ] |
Post subject: | |
Thank you all for your replies, you got exactly what I needed and went beyond my expectations. The splash system is really cool and I never even expected that. Thank you once again. (now I can get back to other parts of my game) Yay! PS: I will see if I can post my game when It's done |