I think I tried to fix it after I copied the stack trace but before I copied the code which is why the numbers were out… here is the code
----------------------------------------------------------------------------------------- -- -- view2.lua -- ----------------------------------------------------------------------------------------- print("miltitouch activated") system.activate( "multitouch" ) print("declerations") local storyboard = require( "storyboard" ) local scene = storyboard.newScene() storyboard.disableAutoPurge = false local pop = audio.loadStream('pop.mp3') local unPop = audio.loadStream('unpop.mp3') --local loading = audio.loadStream('load.mp3') local bubble = {} local timed local score local group local Dscore local Dtime ----------------------------------------------------------------------------------------- -- BEGINNING OF YOUR IMPLEMENTATION -- -- NOTE: Code outside of listener functions (below) will only be executed once, -- unless storyboard.removeScene() is called. -- local Dscore ----------------------------------------------------------------------------------------- print("implementations") -- Called when the scene's view does not exist: function scene:createScene( event ) print("scene:createScene") group = self.view print("group = self.view") init() ------------------------------------------------------------------------------------------- end -- Called immediately after scene has moved onscreen: function scene:enterScene( event ) --local group = self.view print("enterScene") -- do nothing end -- Called when scene is about to move offscreen: function scene:exitScene( event ) local group = self.view print("ExitScene") -- INSERT code here (e.g. stop timers, remove listenets, unload sounds, etc.) end -- If scene's view is removed, scene:destroyScene() will be called just prior to: function scene:destroyScene( event ) print("ERROR: DESTROYING SCENE") -- Dscore = null --Dtime = null --scene:removeSelf() -- INSERT code here (e.g. remove listeners, remove widgets, save state variables, etc.) end function bubbleTap( event ) if timed \>0 then print("popping") local oldBubble = event.target local count = oldBubble.index audio.rewind(pop) audio.play(pop) bubble[count] = display.newImage( 'bubbleDown.png' ) bubble[count].x = oldBubble.x bubble[count].y = oldBubble.y bubble[count].index = count --bubble[Count]:addEventListener("tap", bubbleTap) scene.view:insert(bubble[count]) updateScore() oldBubble:removeSelf() if timed \> 1 then timer.performWithDelay(1500, function() bubbleUnPop(bubble[count]) end) end end end function bubbleUnPop( event ) print("unpopping") local oldBubble = event print("bubble"..oldBubble.index) local count = oldBubble.index audio.rewind(unPop) audio.play(unPop) bubble[count] = display.newImage( 'bubble.png' ) bubble[count].x = oldBubble.x bubble[count].y = oldBubble.y bubble[count].index = count timer.performWithDelay( 100, function() bubble[count]:addEventListener("tap", bubbleTap) end, 1) scene.view:insert(bubble[count]) oldBubble:removeSelf() end function countdown () print("counting down - at: "..timed) print("using clock: ") print(Dtime) if timed == 0 then gameEnd() else timed = timed -1 if(Dtime)then Dtime:removeSelf() end Dtime = display.newText("Time: ".. timed, 0, 0, native.systemFont, 14) Dtime.x = display.contentWidth -30 scene.view:insert(Dtime) end end function updateScore() score = score+1 Dscore:removeSelf() Dscore = display.newText("Score: ".. score, 0, 0, native.systemFont, 14) end function gameEnd( event ) Dscore:removeSelf() Dtime:removeSelf() print("------------------------------------------------------------------------stats-------------------------------------------------------") print(Dscore) print(Dtime) print("-------------------------------------------------------------------------------------------------------------------------------") timer.performWithDelay(100, function() storyboard.gotoScene( "view3", {params = {scored = score}}) end) end function init() print("initialising....") print(Dscore) score = 0 timed = 6 -- create a white background to fill screen print("creating background") local bg = display.newImage('bgG.png' ) print("creating UIBar") local titleBar = display.newRect(0,0,display.contentWidth,20) titleBar:setFillColor(75,0,0) --create the score print("creating Dscore with score of: "..score) Dscore = display.newText("Score: ".. score, 0, 0, native.systemFont, 14) --create the time print("creating Dtime with time of: "..timed) Dtime = display.newText("Time: ".. timed, 0, 0, native.systemFont, 14) Dtime.x = display.contentWidth -30 -- all objects must be added to group (e.g. self.view) group:insert( bg ) print("background inserted") group:insert( titleBar ) print("UI inserted") group:insert( Dtime ) print("Dtime inserted") group:insert( Dscore ) print("Dscore inserted") -------------------------------create the bubbles------------------------------------------ local count = 1 --audio.rewind(load) --audio.play(load) for i=9,display.contentWidth,19 do--bubble horizontal for j=30,display.contentHeight,19 do--bubble verticle print("creating new bubble"..count) bubble[count] = display.newImage('bubble.png' ) bubble[count].index = count bubble[count].x = i bubble[count].y = j group:insert( bubble[count] ) bubble[count]:addEventListener("tap", bubbleTap) count = count+1 end end timer.performWithDelay(1000, countdown, 7) end function reInit() print("reinitialising...") -- storyboard.reloadScene() init() end ----------------------------------------------------------------------------------------- -- END OF YOUR IMPLEMENTATION ----------------------------------------------------------------------------------------- -- "createScene" event is dispatched if scene's view does not exist scene:addEventListener( "createScene", scene ) -- "enterScene" event is dispatched whenever scene transition has finished scene:addEventListener( "enterScene", scene ) -- "exitScene" event is dispatched whenever before next scene's transition begins scene:addEventListener( "exitScene", scene ) -- "destroyScene" event is dispatched before view is unloaded, which can be -- automatically unloaded in low memory situations, or explicitly via a call to -- storyboard.purgeScene() or storyboard.removeScene(). scene:addEventListener( "destroyScene", scene ) ----------------------------------------------------------------------------------------- return scene
and the error is being caused at
Dtime:removeSelf()
thnx for helping, I’ve been working at this all day which for me has now been 12 solid hrs
lol