local composer = require( "composer" ) local scene = composer.newScene() local \_W = display.contentWidth local \_H = display.contentHeight local physics = require("physics" ) physics.setScale( 30 ) physics.setGravity( 0, 0 ) physics.start( ) physics.setDrawMode( "hybrid" ) function scene:create( event ) local sceneGroup = self.view physics.start() ---------------------------- local BackGround = display.newImageRect("BackGround.png", 1080, 1920) return true end function scene:show(event) local sceneGroup = self.view if event.phase == "did" then ------------------------------------------- physics.start() -------------------------------------------- local floor = display.newImageRect("floor.png", 351, 32 ) floor.x = display.contentWidth \* 0.5 floor.y = 520 physics.addBody(floor, "static") ----------------------------------------------- local circle = {} local spawnCircles = function () local FallDown = math.random(display.contentWidth \* 0.2, display.contentWidth \* 0.8 ) circle = display.newImageRect("circle.png", 31, 31 ) circle.x = FallDown circle.y = -70 physics.addBody( circle, "dynamic", {density = .01, friction = 0.5, bounce = 0.1 }) circle.gravityScale = 0.1 physics.setGravity( 0, 10 ) end myTimer = timer.performWithDelay( 2000, spawnCircles, -1) --1000 is the time -------------------------------------------------------------- --------------------------------------------------------------- ------------------------------------------------------------------- end return true end -- ------------------------------------------------------------------------------- -- Listener setup scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) -- ------------------------------------------------------------------------------- return scene
Ok so i simplified the code and i still have the problem… any suggestions?