Still does not work …
I know that English is terrible , but Google Tradudor not help much xD
local composer = require( "composer" ) local scene = composer.newScene() local function buttonHit(event) composer.gotoScene( event.target.destination ) return true end -- inclui a livraria "physics" local physics = require "physics" physics.start() -------------------------------------------- function scene:show( event ) local sceneGroup = self.view local phase = event.phase if phase == "will" then Limites ecrã xminscreen=display.contentCenterX-0.5\*display.actualContentWidth yminscreen=display.contentCenterY-0.5\*display.actualContentHeight xmaxscreen=0.5\*display.actualContentWidth+display.contentCenterX ymaxscreen=display.actualContentHeight+(yminscreen) local borderTop = display.newRect( 0, 0, 115, 100 ) borderTop:setFillColor( 0, 0, 0, 1) -- Invisivel borderTop.strokeWidth = 100 borderTop:setStrokeColor( 0, 0, 0 ) physics.addBody( borderTop, "static", borderBodyElement ) sceneGroup:insert(borderTop) local borderBottom = display.newRect( 0, 100, 707, 1 ) borderBottom.stroke=100 borderBottom:setFillColor( 0, 0, 0, 0) -- Invisivel physics.addBody( borderBottom, "static", borderBodyElement ) sceneGroup:insert(borderBottom) local borderLeft = display.newRect( 0, 1, 1, 1000 ) borderLeft.stroke=10 borderLeft:setFillColor( 0, 0, 0, 0) -- Invisivel physics.addBody( borderLeft, "static", borderBodyElement ) sceneGroup:insert(borderLeft) local borderRight = display.newRect( 707, 1, 1, 1000 ) borderRight.stroke= 100 borderRight:setFillColor( 0, 0, 0, 0) -- Invisivel physics.addBody( borderRight, "static", borderBodyElement ) sceneGroup:insert(borderRight) -- Inserir BackGround local background = display.newImageRect( "CampoFutsal/Campo1F.tif", 512,300 ) background.x = display.contentCenterX + 0 background.y = display.contentCenterY + 0 sceneGroup:insert( background ) --Botão Voltar local backBtn = display.newImageRect("CampoFutsal/botaoV2.tif",25,25) backBtn.x= display.contentCenterX + 240 backBtn.y= display.contentCenterY + 135 backBtn.destination = "menu" backBtn:addEventListener("tap", buttonHit) composer.removeScene(true) sceneGroup:insert(backBtn) --Botão Jogadas local jogadasBtn = display.newImageRect("CampoFutsal/botaoJ.tif",30,30) jogadasBtn.x= display.contentCenterX + 240p jogadasBtn.y= display.contentCenterY - 133 jogadasBtn.destination = "Jogadas1" jogadasBtn:addEventListener("tap", buttonHit) composer.removeScene(true) sceneGroup:insert(jogadasBtn) -- Inserir a Camisola local camisola1 = display.newImageRect("CampoFutsal/Camisola-F1.tif",33,60) camisola1.x = display.contentCenterX - 240 camisola1.y = display.contentCenterY - 115 sceneGroup:insert(camisola1) physics.addBody( camisola1, "static", { friction=0.5, bounce=10 } ) -- Inserir a Camisola local camisola2 = display.newImageRect("CampoFutsal/Camisola-F2.tif",33,60) camisola2.x=display.contentCenterX - 240 camisola2.y=display.contentCenterY - 60 sceneGroup:insert(camisola2) -- Inserir a Camisola local camisola3 = display.newImageRect("CampoFutsal/Camisola-F3.tif",33,60) camisola3.x=display.contentCenterX - 240 camisola3.y=display.contentCenterY + 0 sceneGroup:insert(camisola3) -- Inserir a Camisola local camisola4 = display.newImageRect("CampoFutsal/Camisola-F4.tif",35,60) camisola4.x=display.contentCenterX - 240 camisola4.y=display.contentCenterY + 60 sceneGroup:insert(camisola4) -- Inserir a Camisola local camisola5 = display.newImageRect("CampoFutsal/Camisola-F5.tif",33,60) camisola5.x=display.contentCenterX - 240 camisola5.y=display.contentCenterY + 115 sceneGroup:insert(camisola5) --Função para dar movimento ás camisolas local function camisolaTouch(event) local touchedObject = event.target if event.phase == "began" then touchedObject.previousX = touchedObject.x touchedObject.previousY = touchedObject.y -- Marca o objeto como alvo local parent = touchedObject.parent parent:insert( touchedObject ) display.getCurrentStage():setFocus( touchedObject ) -- Localiza e seleciona o alvo, assim o utilizador pode mudar de objeto touchedObject.isFocus = true elseif event.phase == "moved" or "cancelled" == event.phase then display.getCurrentStage():setFocus( nil ) touchedObject.isFocus = false touchedObject.x = (event.x - event.xStart) + touchedObject.previousX touchedObject.y = (event.y - event.yStart) + touchedObject.previousY end return true end -- Adiciona a função touch ás camisolas, função que dá movimento as camisolas camisola3:addEventListener( "touch" , camisolaTouch) camisola4:addEventListener( "touch" , camisolaTouch) camisola5:addEventListener( "touch" , camisolaTouch) camisola2:addEventListener( "touch" , camisolaTouch) camisola1:addEventListener( "touch" , camisolaTouch) elseif phase == "did" then end end function scene:hide( event ) local sceneGroup = self.view local phase = event.phase if event.phase == "will" then physics.stop() elseif phase == "did" then end end function scene:destroy( event ) local sceneGroup = self.view end ----------------------------------------------------------------------------------------- scene:addEventListener( "create", scene ) scene:addEventListener( "show", scene ) scene:addEventListener( "hide", scene ) scene:addEventListener( "destroy", scene ) ----------------------------------------------------------------------------------------- return scene
This is the application code if I could help find out where the error , thanked :wub: