Collision Help

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
BobTheLawyer
Prole
Posts: 5
Joined: Thu Sep 20, 2012 11:57 pm

Collision Help

Post by BobTheLawyer »

Ok, so I am using bounding box as my collision check.

From there, I am trying to get a left collide, a right collide, an upcollide, and a down collide.

Right now, the apple is the object I am trying to get collision to work for (I think). If I am wrong then which everone you control with wasd.
The gavel (controlled by the arrows) has messed up collision for some reason, so I am only trying to perfect the apple at the moment.

Here is my .love:
http://www.mediafire.com/?qpozf7x3azfabal

So move the gavel wherever you want (in the middle I guess) and then start checking out the collision with the apple.
If you go down right or down left into the gavel, you teleport to a side of it.
That doesn't work if you start next to it, and then start pushing left and down.

Up left and up right will teleport no matter what.
I could implement what I did with the downcollide, but I haven't yet.

The problem is, for my collide, it checks if collide is true for each individual thing.
So if it turns true for one, I want to have true for it.
If I am not colliding, I want to be able to keep moving.
The problem is, I am also getting a false for each other thing I am checking, so I need to know how to make one true for collision, outweigh all my falses.

I'm really bad at explaining this...
If someone understands and can explain this better, please do.
User avatar
markgo
Party member
Posts: 190
Joined: Sat Jan 05, 2013 12:21 am
Location: USA

Re: Collision Help

Post by markgo »

Each of your object were updating their movement twice because your object was colliding with itself and not colliding with the other object. This caused you to move twice as fast. Your physics checking wasn't logical so I restructured it. Best to resolve one direction and then the other direction.
Attachments
Physics.love
(242.06 KiB) Downloaded 171 times
BobTheLawyer
Prole
Posts: 5
Joined: Thu Sep 20, 2012 11:57 pm

Re: Collision Help

Post by BobTheLawyer »

Thank you so much!
Post Reply

Who is online

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