Collision help!
Posted: Thu Sep 04, 2014 6:48 am
Trying to make a game where you are suppose to jump on some boxes that are falling from the sky and try to get as far up as possible but I've ran into some problems with the whole collision bit.
This is my function to create a box and I put everything in a table, but here is the problem, how can I make two objects in the table collide with each other?
Bonus question: how do I make the objects collide with the player?
bonus bonus question: How do I make the objects know if they are falling directly on the players head?
Thanks!
Code: Select all
function spawnObjects(x, y, width, height, yvel, gravity)
local newObject = {x = x, y = y, width = width, height = height, yvel = yvel, gravity = gravity}
table.insert(objects,newObject)
objects.count = objects.count + 1
return newObject
end
This is my function to create a box and I put everything in a table, but here is the problem, how can I make two objects in the table collide with each other?
Bonus question: how do I make the objects collide with the player?
bonus bonus question: How do I make the objects know if they are falling directly on the players head?
Thanks!