my game works perfect when i run it in the simulator but as soon as i build it for my device and open the app the first circle is spawned it gives me that error… on line 96… heres the code
local spawnCircles = function() local Fall = math.random(display.contentWidth \* 0.1, display.contentWidth \* 0.9) circle[bCircle] = display.newImageRect("circle.png", 31, 31 ) circle[bCircle].x = Fall circle[bCircle].y = -70 physics.addBody( circle[bCircle], "dynamic", {bounce = 0} ) physics.setGravity( 0, 0.5) circle[bCircle].collision = onCollision circle[bCircle]:addEventListener( "collision", circle[bCircle] ) circle[bCircle].value = bCircle bCircle = bCircle + 1 end box.collision = onCollision circleTimer = timer.performWithDelay( 1000, spawnCircles, -1 ) local function onAccelerate( event ) if box.x \> display.contentWidth \* 0.1 and box.x \< display.contentWidth \* 0.9 then -- this is line 96 box.x = box.x + (event.xInstant) \* 200 end if box.x \> display.contentWidth \* 0.9 then box.x = display.contentWidth \* 0.89 end if box.x \< display.contentWidth \* 0.1 then box.x = display.contentWidth \* 0.11 end end Runtime:addEventListener( "accelerometer", onAccelerate )
the top is is the spawning circles code and when the first circle is spawned and just about to fal from the screen the error happens… but the box goes left to right just fine before that happens… any idea why? thanks
my question now is how to stop litterly my whole game.lua on collision and just go back to menu.lua… like litterly make it like game.lua never existed… is that possible?