Advertisement
alestane

Untitled

Jan 14th, 2012
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.26 KB | None | 0 0
  1. display.setStatusBar(display.HiddenStatusBar)
  2. local storyboard = require "storyboard"
  3. local scene = storyboard.newScene()
  4.  
  5. local audioBackground, audioChange
  6.  
  7. ----------------------------
  8. -- Functions
  9. ----------------------------
  10.  
  11. local function gotoMenu()
  12.     if options.audio then
  13.         audio.play(audioChange)
  14.     end
  15.     storyboard.gotoScene("menuScene", "fade", 500)
  16. end
  17.  
  18. ----------------------------
  19. -- Storyboard
  20. ----------------------------
  21.  
  22. local loopMusic = {fadein = 1000, loops = -1}
  23.  
  24. function scene:createScene(event)
  25.     local group = self.view
  26.     if options.audio then
  27.         audioBackground = audio.loadStream("audio/title_background" .. storyboard.audioType)
  28.             audio.play(audioBackground, loopMusic)
  29.         audioChange = audio.loadSound("audio/title_change" .. storyboard.audioType)
  30.     end
  31.     local background = display.newImage(group, "visuals/title_background.png", 0, 0)
  32.     Runtime:addEventListener("touch", gotoMenu)
  33. end
  34.  
  35. function scene:exitScene(event)
  36.     if options.audio then
  37.         audio.stop()
  38.         audio.dispose(audioBackground)
  39.         audio.dispose(audioChange)
  40.     end
  41.     Runtime:removeEventListener("touch", gotoMenu)
  42.     storyboard.purgeScene("titleScene")
  43. end
  44.  
  45. scene:addEventListener("createScene", scene)
  46. scene:addEventListener("exitScene", scene)
  47. return scene
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement