Page 1 of 1

Gravity & Collisions

Posted: Wed Dec 24, 2014 3:41 pm
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.

Re: Gravity & Collisions

Posted: Wed Dec 24, 2014 10:56 pm
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.

Re: Gravity & Collisions

Posted: Fri Dec 26, 2014 2:22 am
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.

Re: Gravity & Collisions

Posted: Fri Dec 26, 2014 2:42 am
by Azhukar
You can always use love.physics and look up one of the myriad of box2d tutorials.

Re: Gravity & Collisions

Posted: Fri Dec 26, 2014 2:05 pm
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.

Re: Gravity & Collisions

Posted: Fri Dec 26, 2014 2:12 pm
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.

Re: Gravity & Collisions

Posted: Sat Dec 27, 2014 4:33 am
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.