Will the code you put make up for this…
----------------------------------------------------------------------------------------- -- -- level1.lua -- ----------------------------------------------------------------------------------------- local storyboard = require( "storyboard" ) local scene = storyboard.newScene() -- include Corona's "physics" library local physics = require "physics" physics.start(); physics.pause() physics.setScale(35) -------------------------------------------- -- forward declarations and other locals local screenW, screenH, halfW = display.contentWidth, display.contentHeight, display.contentWidth\*0.5 ----------------------------------------------------------------------------------------- -- BEGINNING OF YOUR IMPLEMENTATION -- -- NOTE: Code outside of listener functions (below) will only be executed once, -- unless storyboard.removeScene() is called. -- ----------------------------------------------------------------------------------------- -- Called when the scene's view does not exist: function scene:createScene( event ) local group = self.view --If the baby touches the Stroller local storyboard = require "storyboard" -- load menu screen -- create a grey rectangle as the backdrop local background = display.newRect( -50, 0, 1000, 850 ) background:setFillColor( 216, 128, 4 ) -- make a crate (off-screen), position it, and rotate slightly local baby = display.newImageRect( "baby.png", 35, 35 ) baby.x, baby.y = 45, -55 baby.rotation = 0 -- add physics to the crate physics.addBody( baby, { density=1.0, friction=0.3, bounce=0.1 } ) -- Making the baby be able to be shot function babyTouched(event) if event.phase == "began" then display.getCurrentStage():setFocus(baby) elseif event.phase == "ended" then baby:applyLinearImpulse(event.xStart - event.x, event.yStart - event.y, baby.x, baby.y) display.getCurrentStage():setFocus(nil) end end baby:addEventListener("touch", babyTouched) --Stroller local stroller = display.newImageRect( "babyStroller.png", 50, 50 ) stroller.x, stroller.y = 425, 218 stroller.rotation = 0 --Stroller physics physics.addBody( stroller, "dynamic", {}, {density=1.0, friction=0.3, bounce=0.3, isSensor=true} ) --collision circle for the stroller function stroller:collision( event ) if event.phase == "began" and event.other.name == "baby" and event.selfElement == 2 then local nextLevel = display.newText( "Go to next level", 50, 50, native.systemFont, 15 ) physics.pause() end end stroller:addEventListener( "collision", stroller ) baby:applyForce(0.35, -1, baby.x, baby.y) --Wall local wall = display.newImageRect( "Wall.png", 50, 100 ) wall.x, wall.y = 185, 188 wall.rotation = 0 --Side Walls local sideWall = display.newImageRect( "SideWallA.png", 100, 1000) sideWall.x, sideWall.y = 5, 100 sideWall.rotation = 0 local sideWallB = display.newImageRect("SideWallA.png", 100, 1000) sideWallB.x, sideWallB.y = 500,100 sideWallB.rotation=0 --Wall physics physics.addBody( wall, "static", {density=1.0, friction=0.3, bounce=0.3}) --Side A/B physics.addBody( sideWall, "static", {density=1.0, friction=0.3, bounce=0.3}) physics.addBody( sideWallB, "static", {density=1.0, friction=0.3, bounce=0.3}) -- create a grass object and add physics (with custom shape) local grass = display.newImageRect( "grass.png", screenW, 82 ) grass:setReferencePoint( display.BottomLeftReferencePoint ) grass.x, grass.y = 0, display.contentHeight -- define a shape that's slightly shorter than image bounds (set draw mode to "hybrid" or "debug" to see) local grassShape = { -halfW,-34, halfW,-34, halfW,34, -halfW,34 } physics.addBody( grass, "static", { friction=0.3, shape=grassShape } ) -- all display objects must be inserted into group group:insert( background ) group:insert( grass) group:insert( baby ) end -- Called immediately after scene has moved onscreen: function scene:enterScene( event ) local group = self.view physics.start() end -- Called when scene is about to move offscreen: function scene:exitScene( event ) local group = self.view physics.stop() end -- If scene's view is removed, scene:destroyScene() will be called just prior to: function scene:destroyScene( event ) local group = self.view package.loaded[physics] = nil physics = nil 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