So I’m following atutorial and I get an error when I tap on an orb. Help please
local \_W = display.viewableContentWidth local \_H = display.viewableContentHeight display.setDefault("background", 1, 0.972549, 0.862745) local mRand = math.random local o = 0 local time\_remain = 10 local time\_up = false local total\_orb = 20 local ready = false local soundtrack = audio.loadStream ("refangold.mp3") local pop\_sound = audio.loadSound("pop.mp3") local win\_sound = audio.loadSound("win.mp3") local fail\_sound = audio.loadSound("fail.mp3") local function trackOrbs(obj) obj:removeSelf() end local function spawnOrb() local orb = display.newImageRect("orb1.png", 60, 60) orb.x = mRand(40, \_W-40); orb.y = mRand(40, \_H-40) local function orbtouch(e) if(e.phase == "ended") then audio.play(pop\_sound) trackOrbs(self) end end orb:addEventListener("touch", orbtouch) end local tmr = timer.performWithDelay(20, spawnOrb, total\_orb)
Thanks for the fast response, now I don’t get an error but the object remains after being clicked on. What exactly is my option with “fixing my code so it doesn’t call trackOrbs()…”?
You are following an offsite and incredibly OLD tutorial. It may have some value still, but the fact that it is 6 years old will put some aspects completely out-of-date and incompatible with modern Corona dev.
That was in the Graphics 1.0 time-frame and we’ve moved way beyond that today.
Thanks for the fast response, now I don’t get an error but the object remains after being clicked on. What exactly is my option with “fixing my code so it doesn’t call trackOrbs()…”?
You are following an offsite and incredibly OLD tutorial. It may have some value still, but the fact that it is 6 years old will put some aspects completely out-of-date and incompatible with modern Corona dev.
That was in the Graphics 1.0 time-frame and we’ve moved way beyond that today.