Making rain using Love2d

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Sosolol261
Party member
Posts: 125
Joined: Wed Nov 26, 2014 6:43 am

Making rain using Love2d

Post by Sosolol261 » Fri Feb 19, 2016 10:31 am

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:

User avatar
zorg
Party member
Posts: 2655
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Making rain using Love2d

Post by zorg » Fri Feb 19, 2016 11:33 am

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
Attachments
raintest.love
(278.17 KiB) Downloaded 312 times
Last edited by zorg on Fri Feb 19, 2016 5:22 pm, edited 1 time in total.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.

bobbyjones
Party member
Posts: 717
Joined: Sat Apr 26, 2014 7:46 pm

Re: Making rain using Love2d

Post by bobbyjones » Fri Feb 19, 2016 3:48 pm

Hmm my back key on Android didn't do a thing. I wonder if it's working.
Do you frequently have great ideas but immediately lose them? Check out the MVP for my website called IdeaVault. It is designed to solve that problem. Desktop browsers only currently.

User avatar
nuno
Party member
Posts: 137
Joined: Wed Dec 11, 2013 12:00 pm
Location: Portugal
Contact:

Re: Making rain using Love2d

Post by nuno » Fri Feb 19, 2016 7:55 pm

something like this?


Sosolol261
Party member
Posts: 125
Joined: Wed Nov 26, 2014 6:43 am

Re: Making rain using Love2d

Post by Sosolol261 » Sat Feb 20, 2016 11:00 am

nuno wrote:something like this?
No i mean ingame rain that actually falls down

User avatar
zorg
Party member
Posts: 2655
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Making rain using Love2d

Post by zorg » Sat Feb 20, 2016 11:17 am

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
Last edited by zorg on Sat Feb 20, 2016 11:57 am, edited 1 time in total.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.

User avatar
nuno
Party member
Posts: 137
Joined: Wed Dec 11, 2013 12:00 pm
Location: Portugal
Contact:

Re: Making rain using Love2d

Post by nuno » Sat Feb 20, 2016 11:18 am

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)

Sosolol261
Party member
Posts: 125
Joined: Wed Nov 26, 2014 6:43 am

Re: Making rain using Love2d

Post by Sosolol261 » Sun Feb 21, 2016 6:06 am

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?

Sosolol261
Party member
Posts: 125
Joined: Wed Nov 26, 2014 6:43 am

Re: Making rain using Love2d

Post by Sosolol261 » Sun Feb 21, 2016 6:07 am

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

User avatar
zorg
Party member
Posts: 2655
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Making rain using Love2d

Post by zorg » Sun Feb 21, 2016 9:33 am

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.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.

Post Reply

Who is online

Users browsing this forum: MistyM, mojojojo, pgimeno and 6 guests