ok so i figured it out… i put the floor image into my “did” part of my scene on the show scene and it worked but now its duplicating my objects… like scene show is duplicating objects heres the code…
local composer = require( "composer" ) local scene = composer.newScene() local physics = require( "physics" ) physics.start( ) physics.setDrawMode( "hybrid" ) function scene:create( event ) local sceneGroup = self.view local BackGround = display.newImageRect("BackGround.png", 1080, 1920) end function scene:show( event ) local sceneGroup = self.view local phase = event.phase if ( phase == "will" ) then elseif ( phase == "did" ) then local floor = display.newImageRect("floor.png", 351, 32) floor.x = display.contentWidth \* 0.5 floor.y = 510 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
im also attaching images so you can try the code youself…
if you prefer i make a video please tell me thanks!