In my games that I made myself, I add code that basically changes the objects y velocity by the games gravity variable which’s adds the y velocity to the y position of the object (unless the object is touching another object then it’s y velocity resets to zero which I have trouble figuring out )
Is there a better or at least easier solution to that?
Is there a better way to add gravity to my game?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- silvr64official
- Prole
- Posts: 1
- Joined: Thu Jun 01, 2023 11:42 am
Is there a better way to add gravity to my game?
Where's the kaboom, theres supposed to be an earth shattering kaboom?
Re: Is there a better way to add gravity to my game?
If you want easier solution than implementing whole physics, you can take a look at love.physics module
- BrotSagtMist
- Party member
- Posts: 664
- Joined: Fri Aug 06, 2021 10:30 pm
Re: Is there a better way to add gravity to my game?
Thats already a three lines solution. Hard to make it any easier.
Where is it troubling you?
Where is it troubling you?
obey
Re: Is there a better way to add gravity to my game?
You can google my Mars Lander on itch.io that has gravity and thrust and all those fun things. You'll probably be confused by that code. I know I am. 8-)
Love.physics is a full blown physics engine that takes some practice.
Sounds like you need to do some sort of bounding box type detection otherwise just apply downwards gravity * dt every cycle.
Love.physics is a full blown physics engine that takes some practice.
Sounds like you need to do some sort of bounding box type detection otherwise just apply downwards gravity * dt every cycle.
Last project:
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Idle gridiron. Set team orders then idle and watch: https://togfox.itch.io/pad-and-pencil-gridiron
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Idle gridiron. Set team orders then idle and watch: https://togfox.itch.io/pad-and-pencil-gridiron
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 7 guests