Hello,
I am making my game and its a helium baloon that changes the law of gravity so it floats up. So im trying to make it so you tap the top of the baloon and it moves down and you tap the left of the baloon and it moves right, and you tap the right of the baloon and it moves to the left.
In my code its supposed to move in all those positions but it only moves to the right when you tap the baloon. Any help.
[code]
–Move the baloon to the right
function reverse(event)
baloon:applyLinearImpulse( 5, 0, baloon.x, baloon.y )
end
function right(event)
baloon:applyLinearImpulse( 0, 5, baloon.x, baloon.y )
end
–End
–Move the baloon up
function moveUp(event)
baloon1:applyLinearImpulse( 0, 15, baloon1.x, baloon1.y )
end
function up(event)
baloon1:applyLinearImpulse( 15, 0, baloon1.x, baloon1.y )
end
–End
–Touch Listeners
baloon:addEventListener(“tap”, reverse)
baloon1:addEventListener(“tap”, moveUp)
[code] [import]uid: 44060 topic_id: 8333 reply_id: 308333[/import]
[import]uid: 44060 topic_id: 8333 reply_id: 30250[/import]