Page 1 of 3

Making rain using Love2d

Posted: Fri Feb 19, 2016 10:31 am
by Sosolol261
I've been working on a project that needs a way to draw rain. I've tried to use particles but the particle system doesn't seem to be made for "rain" particles or i am just bad.

My request: Could you guys tell me ways to simulate rain(without collision and or anything) just a way to draw rain particles? Thank you! :awesome:

Re: Making rain using Love2d

Posted: Fri Feb 19, 2016 11:33 am
by zorg
You could cheat by using an image (a rain texture) with a mesh; each update, modifying the texture position, so it looks like it's falling; I'll create a demo thing in a jiffy :3
Edit: Attached. Press space to make it REAL intense, and escape exits (if you'd want to test it on android)

Edit2: Uploaded a new version, just to be sure, it checks both keycode and scancode for escape and space, maybe it will work for you now, Bobby :3

Re: Making rain using Love2d

Posted: Fri Feb 19, 2016 3:48 pm
by bobbyjones
Hmm my back key on Android didn't do a thing. I wonder if it's working.

Re: Making rain using Love2d

Posted: Fri Feb 19, 2016 7:55 pm
by nuno
something like this?


Re: Making rain using Love2d

Posted: Sat Feb 20, 2016 11:00 am
by Sosolol261
nuno wrote:something like this?
No i mean ingame rain that actually falls down

Re: Making rain using Love2d

Posted: Sat Feb 20, 2016 11:17 am
by zorg
Sosolol261 wrote:
nuno wrote:something like this?
No i mean ingame rain that actually falls down
I take it my solution won't/didn't work for you then? :3

Re: Making rain using Love2d

Posted: Sat Feb 20, 2016 11:18 am
by nuno
Sosolol261 wrote:
nuno wrote:something like this?
No i mean ingame rain that actually falls down
it does fall down, did you see the video in full screen? low res doesnt show the rain properly (i'm not talking about the rain drops in the screen)

Re: Making rain using Love2d

Posted: Sun Feb 21, 2016 6:06 am
by Sosolol261
zorg wrote:
Sosolol261 wrote:
nuno wrote:something like this?
No i mean ingame rain that actually falls down
I take it my solution won't/didn't work for you then? :3
Your solution is really close.. The reason i want to stick to the particles is that I could use a "wind" parameter to adjust the path of a rain drop mid-game and smooth.. does that make sense?

Re: Making rain using Love2d

Posted: Sun Feb 21, 2016 6:07 am
by Sosolol261
nuno wrote:
Sosolol261 wrote:
nuno wrote:something like this?
No i mean ingame rain that actually falls down
it does fall down, did you see the video in full screen? low res doesnt show the rain properly (i'm not talking about the rain drops in the screen)
Yes something like this would be great

Re: Making rain using Love2d

Posted: Sun Feb 21, 2016 9:33 am
by zorg
Sosolol261 wrote:
zorg wrote:
Sosolol261 wrote:No i mean ingame rain that actually falls down
I take it my solution won't/didn't work for you then? :3
Your solution is really close.. The reason i want to stick to the particles is that I could use a "wind" parameter to adjust the path of a rain drop mid-game and smooth.. does that make sense?
If you look at my code, you'll see that if you press space, the game draws a second instance of the rain mesh, and it modifies the uv (texture) coordinates in such a way, that it will be acting like the wind is indeed modifying the angle with which it's falling. In your case, the wind parameter could be just the horizontal displacement value, and making that random (smoothed in a way) could definitely work imo.