Gravity & Collisions

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.
Post Reply
Atton
Prole
Posts: 15
Joined: Mon Aug 26, 2013 1:38 pm

Gravity & Collisions

Post by Atton »

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
User avatar
Duster
Prole
Posts: 32
Joined: Fri Dec 19, 2014 8:34 pm
Location: Ontario, Canada

Re: Gravity & Collisions

Post by Duster »

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.
Atton
Prole
Posts: 15
Joined: Mon Aug 26, 2013 1:38 pm

Re: Gravity & Collisions

Post by Atton »

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.
What is ATC can where can I find links to it that and the tutorials.
User avatar
Azhukar
Party member
Posts: 478
Joined: Fri Oct 26, 2012 11:54 am

Re: Gravity & Collisions

Post by Azhukar »

You can always use love.physics and look up one of the myriad of box2d tutorials.
Atton
Prole
Posts: 15
Joined: Mon Aug 26, 2013 1:38 pm

Re: Gravity & Collisions

Post by Atton »

Azhukar wrote:You can always use love.physics and look up one of the myriad of box2d tutorials.
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.
User avatar
Azhukar
Party member
Posts: 478
Joined: Fri Oct 26, 2012 11:54 am

Re: Gravity & Collisions

Post by Azhukar »

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.
Box2d is included in love2d under the name of love.physics, it is not another game engine.
Atton
Prole
Posts: 15
Joined: Mon Aug 26, 2013 1:38 pm

Re: Gravity & Collisions

Post by Atton »

Azhukar wrote:
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.
Box2d is included in love2d under the name of love.physics, it is not another game engine.
Ok I see thanks.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 3 guests