local composer = require( “composer” )
local scene = composer.newScene()
local function buttonHit(event)
composer.gotoScene( event.target.destination )
return true
end
– include Corona’s “physics” library
local physics = require “physics”
physics.start(); physics.pause()
– forward declarations and other locals
local screenW, screenH, halfW = display.contentWidth, display.contentHeight, display.contentWidth*0.5
function scene:create( event )
local sceneGroup = self.view
– create a grey rectangle as the backdrop
local background = display.newImage( “Campo1F.tif”, true )
background.x = display.contentWidth / 2
background.y = display.contentHeight / 2
– all display objects must be inserted into group
sceneGroup:insert( background )
end
function scene:show( event )
local sceneGroup = self.view
local phase = event.phase
if phase == “will” then
–Voltar
local backBtn = display.newImageRect(“botaoV.tif”,50,25)
backBtn.x= 500
backBtn.y= 296
backBtn.destination = “menu”
backBtn:addEventListener(“tap”, buttonHit)
composer.removeScene(true)
sceneGroup:insert(backBtn)
– Inserir a Camisola
local camisola1 = display.newImageRect(“Camisola-F1.tif”,35,60)
camisola1.x = 45
camisola1.y = 50
sceneGroup:insert(camisola1)
– Inserir a Camisola
local camisola2 = display.newImageRect(“Camisola-F2.tif”,35,60)
camisola2.x=45
camisola2.y=110
sceneGroup:insert(camisola2)
– Inserir a Camisola
local camisola3 = display.newImageRect(“Camisola-F3.tif”,35,60)
camisola3.x=45
camisola3.y=160
sceneGroup:insert(camisola3)
– Inserir a Camisola
local camisola4 = display.newImageRect(“Camisola-F4.tif”,35,60)
camisola4.x=45
camisola4.y=210
sceneGroup:insert(camisola4)
– Inserir a Camisola
local camisola5 = display.newImageRect(“Camisola-F5.tif”,35,60)
camisola5.x=45
camisola5.y=260
sceneGroup:insert(camisola5)
local function camisolaTouch(event)
local touchedObject = event.target
if event.phase == “began” then
touchedObject.previousX = touchedObject.x
touchedObject.previousY = touchedObject.y
elseif event.phase == “moved” then
touchedObject.x = (event.x - event.xStart) + touchedObject.previousX
touchedObject.y = (event.y - event.yStart) + touchedObject.previousY
end
return true
end
–Botao back Android - Runtime:addEventListener( “key”, onKeyEvent )
camisola3:addEventListener( “touch” , camisolaTouch)
camisola4:addEventListener( “touch” , camisolaTouch)
camisola5:addEventListener( “touch” , camisolaTouch)
camisola2:addEventListener( “touch” , camisolaTouch)
camisola1:addEventListener( “touch” , camisolaTouch)
elseif phase == “did” then
physics.start()
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 )