I have this piece of code, I am using it to detect collisions, It does detects collisions but only if the character never jumps and continue to trace through the same elliptical path, If I jump the character even once, The collision is never detected in the the game ever. Where am I doing it wrong?
if playertouch then 
    speed = 10
    angle2 = 30
    speedx = math.cos(20)
    speedy = math.sin(130)
    velocityx = speed*speedx
    velocityy = speed*speedy
    point = tntCollision.pointToObox
    for i = 1, 1 do 
        x = x + velocityx
        y = y + velocityy
        self: setScaleY(1.8)
        if point (x, y, sechand:getX(), sechand:getY(),206, 64, sechand:getRotation()) then 
            tntCollision.setCollisionAnchorPoint(0.2257, 0.5)
    end
end
elseif playertouch == false  then 
   for i = 1,1 do
        x =  x - velocityx
        y =  y - velocityy
        x = 215 +  math.cos(angle)*195 
        y = 130 + math.sin(angle)*115 
        self:setScaleY(1)
        if point (x, y, sechand:getX(), sechand:getY(),206, 64, sechand:getRotation()) then 
            tntCollision.setCollisionAnchorPoint(0.2257, 0.5)
        end 
   end       
else 
    x = 215 +  math.cos(angle)*195 
    y = 130 + math.sin(angle)*115 
    if point (x, y, sechand:getX(), sechand:getY(),206, 64, sechand:getRotation()) then 
        tntCollision.setCollisionAnchorPoint(0.2257, 0.5)       
        print('end of game')    
    end
end  
self:setPosition(x,y)                
                
             
        
Comments
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps