Hey,
Once my ball “redOrb” touches “line” then the ball is pulled towards it quickly. The only problem is a the moment the ball is pulled right when i relaunch the simulator… The function that pulls the ball towards “yellowOrb” is not what i’ve planned. I want the function to start once the ball touches “line”, i can’t add the function in the collision. So i’ve improvised and tried making gameLoop = false, once collision with 'line" it should = true. But for some reason did not work? I think that is the solution, is there any other way? Can any one help with this ?
[code]
– This is part of my code, did not add the objects on this bit. Just wanted to know how i can do this.
– Function that pulls redOrb towards yellowOrb.
local SPEED = 4
function gameLoop(event)
– constantly adjust velocity to track yellowOrb
redOrb:setLinearVelocity(
SPEED * (yellowOrb.x - redOrb.x),
SPEED * (yellowOrb.y - redOrb.y)
)
end
Runtime:addEventListener(“enterFrame”, gameLoop)
– Collision with ball “redOrb”
line.myName = “line”
redOrb.myName = “redOrb”
line:addEventListener(“collision”, line)
function line:collision (event)
if event.other.myName == “redOrb” then
– I want to add the function above to the collision.
– gameLoop = false? When touched line gameLoop = true? Tried but no success… Help?
end
end
[import]uid: 23689 topic_id: 12842 reply_id: 312842[/import]
[import]uid: 52491 topic_id: 12842 reply_id: 47158[/import]