Hey Guys,
I’m pretty new to LUA so forgive me for my lack of insight. I’m trying to keep from referencing variables directly as recommended but I can’t seem to get the external function to pass the method through. My app keeps crashing the simulator and tells me that “object” is “a nil value” but from my understanding, I thought that rBloon would get passed through since I feed Self(should it be rBloon) into it. Even if I pass rBloon specifically through it tells me the method applyForce is now nil.
Please steer me in a direction. Thanks!
[code]
local function floatForce(object)
object:applyForce( 0, -.1, object.x, object.y )
end
local function spawnBloon()
local rBloon = display.newCircle(180, 200, 10 )
–MAKE IT FLOAT
function balloonFloat()
floatForce(self)
end
Runtime:addEventListener(“enterFrame”, balloonFloat)
end
–CLICK RED
local function clickRedButton(event)
local phase = event.phase
if “ended” == phase and gameReady == true then
if rBloonCur == 0 then
rBloonCur = rBloonCur + 1
–IF NO BLOON CREATE IT AND MAKE IT FLOAT
spawnBloon()
elseif rBloonCur >= 1 and rBloonCur <= 2 then
rBloonCur = rBloonCur + 1
elseif rBloonCur == 3 then
print(“pop!”)
rBloonCur = 0
–Remove Bloon
popBloon(rBloon)
rBloonTot = rBloonTot + 1
end
print("current RedBloon Size " … rBloonCur)
end
end
bloonRedButton:addEventListener(“touch”, clickRedButton)
end[/code] [import]uid: 10361 topic_id: 7080 reply_id: 307080[/import]
