Hi Everyone,
I know I have been posting a lot but I was just wondering if anyone had any idea how to find the Y coordinates of collision data at a certain X coordinate?
Thanks,
Chris [import]uid: 126017 topic_id: 23839 reply_id: 323839[/import]
Hi Everyone,
I know I have been posting a lot but I was just wondering if anyone had any idea how to find the Y coordinates of collision data at a certain X coordinate?
Thanks,
Chris [import]uid: 126017 topic_id: 23839 reply_id: 323839[/import]
simple. something like this should work:
-- example: hitTestLine ( 100, enemy1, 50 )
-- returns: y-coordinate of object that hits the line
-- lineX (imaginary line at x)
-- theObject (object that hits the line)
-- distance (trigger hit at distance to line)
hitTestLine = function( lineX, theObject, distance )
local dist = distance or 10
if theObject.x \> lineX + dist or
theObject.x \< lineX - dist then
return false
else
-- print ("HIT!")
return theObject.y
end
end
-finefin [import]uid: 70635 topic_id: 23839 reply_id: 96068[/import]