Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local storyboard = require( "storyboard" )
- local scene = storyboard.newScene()
- local widget = require "widget"
- local loadsave = require("loadsave")
- local one, two, three, four, five
- storyboard.state = {}
- storyboard.state.clevel = {}
- storyboard.state.clevel.bi = 0
- storyboard.state.clevel.hiru = 0
- storyboard.state.clevel.lau = 0
- storyboard.state.clevel.bost = 0
- loadsave.saveTable(storyboard.clevel, "clevel.json")
- local function scrollListener( event )
- local phase = event.phase
- local direction = event.direction
- if "began" == phase then
- print( "Began" )
- elseif "moved" == phase then
- print( "Moved" )
- elseif "ended" == phase then
- print( "Ended" )
- end
- if event.limitReached then
- if "up" == direction then
- print( "Reached Top Limit" )
- elseif "down" == direction then
- print( "Reached Bottom Limit" )
- elseif "left" == direction then
- print( "Reached Left Limit" )
- elseif "right" == direction then
- print( "Reached Right Limit" )
- end
- end
- return true
- end
- local function bat()
- storyboard.gotoScene( "levels.1.level1", "fade", 500 )
- return true
- end
- local function bi()
- if (storyboard.state.clevel.bi == 1) then
- storyboard.gotoScene( "levels.2.level1", "fade", 500 )
- end
- return true
- end
- local function hiru()
- if (storyboard.state.clevel.hiru == 1) then
- storyboard.gotoScene( "levels.3.level1", "fade", 500 )
- end
- return true
- end
- local function lau()
- if (storyboard.state.clevel.lau == 1) then
- storyboard.gotoScene( "levels.4.level1", "fade", 500 )
- end
- return true
- end
- local function bost()
- if (storyboard.state.clevel.bost == 1) then
- storyboard.gotoScene( "levels.5.level1", "fade", 500 )
- end
- return true
- end
- function scene:createScene( event )
- local group = self.view
- local fondo = display.newImageRect( "irudiak/fondo.png", display.contentWidth, display.contentHeight )
- fondo:setReferencePoint( display.TopLeftReferencePoint )
- fondo.x, fondo.y = 0, 0
- local one = widget.newButton{
- label="1. Maila",
- labelColor = { default={0}, over={128} },
- fontSize = 50,
- defaultFile="irudiak/botoia.png",
- overFile="irudiak/botoia.png",
- width=240, height=70,
- onRelease = bat
- }
- one:setReferencePoint( display.CenterReferencePoint )
- one.x = 180
- one.y = 70
- local two = widget.newButton{
- label="2. Maila",
- labelColor = { default={0}, over={128} },
- fontSize = 50,
- defaultFile="irudiak/botoia.png",
- overFile="irudiak/botoia.png",
- width=240, height=70,
- onRelease = bi
- }
- two:setReferencePoint( display.CenterReferencePoint )
- two.x = 180
- two.y = 150
- local three = widget.newButton{
- label="3. Maila",
- labelColor = { default={0}, over={128} },
- fontSize = 50,
- defaultFile="irudiak/botoia.png",
- overFile="irudiak/botoia.png",
- width=240, height=70,
- onRelease = hiru
- }
- three:setReferencePoint( display.CenterReferencePoint )
- three.x = 180
- three.y = 230
- local four = widget.newButton{
- label="4. Maila",
- labelColor = { default={0}, over={128} },
- fontSize = 50,
- defaultFile="irudiak/botoia.png",
- overFile="irudiak/botoia.png",
- width=240, height=70,
- onRelease = lau
- }
- four:setReferencePoint( display.CenterReferencePoint )
- four.x = 180
- four.y = 310
- local five = widget.newButton{
- label="5. Maila",
- labelColor = { default={0}, over={128} },
- fontSize = 50,
- defaultFile="irudiak/botoia.png",
- overFile="irudiak/botoia.png",
- width=240, height=70,
- onRelease = bost
- }
- five:setReferencePoint( display.CenterReferencePoint )
- five.x = 180
- five.y = 390
- local scrollView = widget.newScrollView{
- top = 0,
- left = 0,
- width = display.contentWidth,
- height = display.contentHeight,
- hideBackground = true,
- bottomPadding = 50,
- listener = scrollListener,
- }
- group:insert( fondo )
- group:insert( one )
- group:insert( two )
- group:insert( three )
- group:insert( four )
- group:insert( five )
- group:insert( scrollView )
- scrollView:insert( one )
- scrollView:insert( two )
- scrollView:insert( three )
- scrollView:insert( four )
- scrollView:insert( five )
- end
- function scene:enterScene( event )
- local group = self.view
- end
- function scene:exitScene( event )
- local group = self.view
- end
- function scene:destroyScene( event )
- local group = self.view
- if playBtn then
- playBtn:removeSelf()
- playBtn = nil
- end
- end
- scene:addEventListener( "createScene", scene )
- scene:addEventListener( "enterScene", scene )
- scene:addEventListener( "exitScene", scene )
- scene:addEventListener( "destroyScene", scene )
- return scene
Advertisement
Add Comment
Please, Sign In to add comment