2. Assign some value to it. Variable lets you change the strength of the gravity and it's direction. Let it be that grav = 10. Just for example.
3. Create a variable with your current Y-axis speed. Let us call that y_vel.
4. Every love.update increase the speed: y_vel = y_vel+grav.
Now you have everything to go further. The length of a way something passes is speed*time.
You have both:
- dt in love.update stores the amount of time you haven't take into account yet
- y_vel stores your Y-axis speed.
Now all you have to do is check for collisions and react to the results.
This is a very library-specific process, but generally all you need to do would be:
- check, whether there is a collision
- if there is, check whether it should be acknowledged as one that hinders your movement.
Basically, whenever your_Y_coordinate+your_Height is bigger or equal to a platform's_Y_coordinate you should stop your movement.
Setting y_vel to 0 is a way to do this: with y_vel==0 the [5] would look like y=y+0*dt. Ergo, you won't move by Y-axis.
But simple check for coordinates may result in passing through thin floors.
I recommend you to try out Bump. It is rather simple to use and have descent documentation.
Here's the library and the documentation: https://github.com/kikito/bump.lua
You also can use my platformer prototype to learn a thing or two on how to utilize a fraction of Bump's power.
I humbly ask to not go further than fair dealing, though. Thanks in advance!