Can I use this to make the object stop moving down when touching with other object.
local function moveDown() if obj.y \< alreadyStackedObject.y then obj.y = obj.y + 1 else obj.y = obj.y + 0 end
Can I use this to make the object stop moving down when touching with other object.
local function moveDown() if obj.y \< alreadyStackedObject.y then obj.y = obj.y + 1 else obj.y = obj.y + 0 end
If the reference point of object if bottom and alreadystackedobject is top
You don’t need the else clause either.
if obj.y \< alreadyStackedObject.y then obj.y = obj.y + 1 end
would be sufficient. But as @jstrahan said, the reference points of the objects have to be where they line up. There is a simple function used to detect when two boxes are touching. See:
http://omnigeek.robmiracle.com/2011/12/14/collision-detection-without-physics/
My two objects are falling down from the top , can I use collision without physics to check if the first object are stop and the second object is collision with the first then stop falling and spawn the two objects again and check collision again.
The collision events are only for physics
Can I make the block be alreadyStackedObject after the block is falling down from the top and stop in bottom and use this :
if obj.y \< alreadyStackedObject.y then obj.y = obj.y + 1 end
in Tetris style game.
If the reference point of object if bottom and alreadystackedobject is top
You don’t need the else clause either.
if obj.y \< alreadyStackedObject.y then obj.y = obj.y + 1 end
would be sufficient. But as @jstrahan said, the reference points of the objects have to be where they line up. There is a simple function used to detect when two boxes are touching. See:
http://omnigeek.robmiracle.com/2011/12/14/collision-detection-without-physics/
My two objects are falling down from the top , can I use collision without physics to check if the first object are stop and the second object is collision with the first then stop falling and spawn the two objects again and check collision again.
The collision events are only for physics
Can I make the block be alreadyStackedObject after the block is falling down from the top and stop in bottom and use this :
if obj.y \< alreadyStackedObject.y then obj.y = obj.y + 1 end
in Tetris style game.