Edit: I think i know the problem! I am also cancelling the transition so i do recall the table but i just need to recall the transition again! Im going to look up how to do that exactly!
I am trying to recall this line but it gives me an error!
enemytable[enemyCnt].trans = transition.to ( enemytable[enemyCnt], { x=centerX, y=centerY, time=math.random(2500-speedBump, 4500-speedBump), onComplete=hitPlanet } )
for i = 1, enemyCnt do if enemytable[i].trans then transition.cancel(enemytable[i].trans) enemytable[i].trans = nil end end for i = enemyCnt, 1, -1 do -- enemycnt till 1 everytime -1 display.remove(enemytable[i]) enemytable[i] = nil end enemytable = nil
Hi there!
I am trying to set the table back to what it was with the sceneshow… i dont have much there only 2 functions.
The table is set again with enemytable = {}, this should set the table back since the for loop sets it to nil. All i need to do is set it back to {} right?
-- "scene:create()" function scene:create( event ) local sceneGroup = self.view -- Initialize the scene here. -- Example: add display objects to "sceneGroup", add touch listeners, etc. end -- "scene:show()" function scene:show( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then -- Called when the scene is still off screen (but is about to come on screen). print("Show play scene") elseif ( phase == "did" ) then -- Called when the scene is now on screen. -- Insert code here to make the scene come alive. -- Example: start timers, begin animation, play audio, etc. createPlayScreen(sceneGroup) setUpDisplay(sceneGroup) enemytable = {} end end