Gravity & Collisions
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Gravity & Collisions
I have a question that I will try to keep blunt, how would it be possible to great a system where an object will be affected by gravity and collisions. It would be preferred if this object was the player. I am using STI as suggested by a rather smart person who is more in touch with things than I. My project is attached in this thread however I have no legitimate expectation that anyone would actually read the code. If someone has example of game built using with usage of STI that could help or an example would be great.
- Attachments
-
- Atton's Tester.zip
- (29.74 KiB) Downloaded 142 times
Re: Gravity & Collisions
I suggest reading some basic Love tutorials as they will cover this exact subject in more depth than I will.
Gravity is as simple as "player.vy = player.vy + gravity * dt". Collisions are a whole other matter though, and they kinda depend on what lib you're using/if you're even using a lib at all. I use ATL+ATC instead of STI, so collisions are as simple as setting flags on tiles in Tiled, creating a player collision body, then resolving collisions based on the flag of whatever tile I'm touching. ATC has built-in functions for all of that.
Gravity is as simple as "player.vy = player.vy + gravity * dt". Collisions are a whole other matter though, and they kinda depend on what lib you're using/if you're even using a lib at all. I use ATL+ATC instead of STI, so collisions are as simple as setting flags on tiles in Tiled, creating a player collision body, then resolving collisions based on the flag of whatever tile I'm touching. ATC has built-in functions for all of that.
Re: Gravity & Collisions
What is ATC can where can I find links to it that and the tutorials.Duster wrote:I suggest reading some basic Love tutorials as they will cover this exact subject in more depth than I will.
Gravity is as simple as "player.vy = player.vy + gravity * dt". Collisions are a whole other matter though, and they kinda depend on what lib you're using/if you're even using a lib at all. I use ATL+ATC instead of STI, so collisions are as simple as setting flags on tiles in Tiled, creating a player collision body, then resolving collisions based on the flag of whatever tile I'm touching. ATC has built-in functions for all of that.
Re: Gravity & Collisions
You can always use love.physics and look up one of the myriad of box2d tutorials.
Re: Gravity & Collisions
I'd prefer not to use another game engine, also if there is any confusion I am using STI. If no one has anything thing else to add might be worth locking this.Azhukar wrote:You can always use love.physics and look up one of the myriad of box2d tutorials.
Re: Gravity & Collisions
Box2d is included in love2d under the name of love.physics, it is not another game engine.Atton wrote:I'd prefer not to use another game engine, also if there is any confusion I am using STI. If no one has anything thing else to add might be worth locking this.
Re: Gravity & Collisions
Ok I see thanks.Azhukar wrote:Box2d is included in love2d under the name of love.physics, it is not another game engine.Atton wrote:I'd prefer not to use another game engine, also if there is any confusion I am using STI. If no one has anything thing else to add might be worth locking this.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 3 guests