I don’t see where your function bgf() is being called anywhere, but if you do:
if event.phase == “moved” and event.phase == “began” then
You can’t have an event.phase be both “moved” and “begain” at the same time. This will always evaluate to false.
I don’t know what this line of code is and if it’s a comment that’s not commented out, your app will be generating errors:
get stage and call ‘setFocus()’ method
You repeat these three lines of code, though it should have no effect:
local stage = display.getCurrentStage()
stage:setFocus( bubble )
bubble.isFocus = true
Your function move() does nothing.
You don’t handle a the event.phase == “moved” in your gameStart() function, which is your bubble’s event handler.
You blindly remove your instructions and title every time bubble is touched. You need to test to make sure they exist and have not already been removed before you try and remove them. You also are not setting the values to nil when you are done removing them. Consider:
if title and title.removeSelf then
title:removeSelf()
title = nil
end
This makes sure that title exists, it’s still a display object and properly cleans it up.
Finally touch events generate a minimum of two events: a “began” event and an “ended” event. You will also get multiple “moved” events. So lets say you touch the balloon and move it a bit and let up, your hitWall() function is going to get called once for every one of those events. I’m not sure that’s what you want to happen.
Finally your function should probably be doing: return true
at the end to keep the event from going on to other display objects.