Browse files

Initial working version

  • Loading branch information...
1 parent 21183a7 commit 61f2febaa60908f98c0e068eeba7fca0d10129bd @radamanthus radamanthus committed Jan 2, 2011
View
32 about.lua
@@ -0,0 +1,32 @@
+module(..., package.seeall)
+
+-- Main function - MUST return a display.newGroup()
+function new()
+ local localGroup = display.newGroup()
+
+ -- Background
+ local background = display.newImage("images/backgrounds/menu.png")
+ localGroup:insert(background)
+
+ -- Title
+ local title = display.newText("Touch to go back", 0, 0, native.systemFontBold, 16)
+ title:setTextColor( 255,255,255)
+ title.x = 160
+ title.y = 240
+ title.name = "title"
+ localGroup:insert(title)
+
+ -- Touch to go back
+ local function touched ( event )
+ if event.phase == "ended" then
+ director:changeScene("menu","fade")
+ end
+ end
+ background:addEventListener("touch",touched)
+
+ unloadMe = function()
+ end
+
+ -- MUST return a display.newGroup()
+ return localGroup
+end
View
15 build.settings
@@ -0,0 +1,15 @@
+settings =
+{
+ orientation =
+ {
+ default = "landscapeRight",
+ supported =
+ {
+ "landscapeLeft", "landscapeRight",
+ },
+ },
+ androidPermissions =
+ {
+ "android.permission.INTERNET"
+ },
+}
View
415 director.lua
@@ -0,0 +1,415 @@
+module(..., package.seeall)
+
+--====================================================================--
+-- DIRECTOR CLASS
+--====================================================================--
+--
+-- Version: 1.1
+-- Made by Ricardo Rauber Pereira @ 2010
+-- Blog: http://rauberlabs.blogspot.com/
+-- Mail: ricardorauber@gmail.com
+--
+-- This class is free to use, feel free to change but please send new versions
+-- or new features like new effects to me and help us to make it better!
+--
+--====================================================================--
+-- CHANGES
+--====================================================================--
+--
+-- 06-OCT-2010 - Ricardo Rauber - Created
+-- 07-OCT-2010 - Ricardo Rauber - Functions loadScene and fxEnded were
+-- taken off from the changeScene function;
+-- Added function cleanGroups for best
+-- memory clean up;
+-- Added directorView and effectView groups
+-- for better and easier control;
+-- Please see INFORMATION to know how to use it
+--
+--====================================================================--
+-- VARIABLES
+--====================================================================--
+--
+-- currentView: Main display group
+-- nextView: Display group for transitions
+-- currentScreen: Active module
+-- nextScreen: New module
+-- lastScene: Active module in string for control
+-- nextScene: New module in string for control
+-- effect: Transition type
+-- arg[N]: Arguments for each transition
+-- fxTime: Time for transition.to
+--
+--====================================================================--
+-- INFORMATION
+--====================================================================--
+--
+-- * For best practices, use fps=60, scale = "zoomStretch" on config.lua
+--
+-- * In main.lua file, you have to import the class like this:
+--
+-- director = require("director")
+-- local g = display.newGroup()
+-- g:insert(director.directorView)
+--
+-- * To change scenes, use this command [use the effect of your choice]
+--
+-- director:changeScene("settings","moveFromLeft")
+--
+-- * Every scene is a lua module file and must have a new() function that
+-- must return a local display group, like this: [see template.lua]
+--
+-- module(..., package.seeall)
+-- function new()
+-- local lg = display.newGroup()
+-- ------ Your code here ------
+-- return lg
+-- end
+--
+-- * Every display object must be inserted on the local display group
+--
+-- local background = display.newImage("background.png")
+-- lg:insert(background)
+--
+-- * This class doesn't clean timers! If you want to stop timers when
+-- change scenes, you'll have to do it manually.
+--
+--====================================================================--
+
+directorView = display.newGroup()
+currentView = display.newGroup()
+nextView = display.newGroup()
+effectView = display.newGroup()
+--
+local currentScreen, nextScreen
+local lastScene = "main"
+local fxTime = 200
+--
+directorView:insert(currentView)
+directorView:insert(nextView)
+directorView:insert(effectView)
+
+------------------------------------------------------------------------
+-- CLEAN GROUP
+------------------------------------------------------------------------
+
+local function cleanGroups ( curGroup, level )
+ if curGroup.numChildren then
+ while curGroup.numChildren > 0 do
+ cleanGroups ( curGroup[curGroup.numChildren], level+1 )
+ end
+ if level > 0 then
+ curGroup:removeSelf()
+ end
+ else
+ curGroup:removeSelf()
+ curGroup = nil
+ return
+ end
+end
+
+------------------------------------------------------------------------
+-- LOAD SCENE
+------------------------------------------------------------------------
+
+local function loadScene ( nextScene )
+
+ nextScreen = require(nextScene).new()
+ nextView:insert(nextScreen)
+
+end
+
+------------------------------------------------------------------------
+-- EFFECT ENDED
+------------------------------------------------------------------------
+
+local function fxEnded ( event )
+
+ currentView.x = 0
+ currentView.y = 0
+ currentView.xScale = 1
+ currentView.yScale = 1
+ --
+ cleanGroups(currentView,0)
+ --
+ currentScreen = nextScreen
+ currentView:insert(currentScreen)
+ nextView.x = display.contentWidth
+ nextView.y = 0
+ nextView.xScale = 1
+ nextView.yScale = 1
+
+end
+
+------------------------------------------------------------------------
+-- CHANGE SCENE
+------------------------------------------------------------------------
+
+function director:changeScene(nextScene,
+ effect,
+ arg1,
+ arg2,
+ arg3)
+
+
+ -----------------------------------
+ -- If is the same, don't change
+ -----------------------------------
+
+ if lastScene then
+ if string.lower(lastScene) == string.lower(nextScene) then
+ return true
+ end
+ end
+
+ local showFx
+
+ -----------------------------------
+ -- EFFECT: Move From Right
+ -----------------------------------
+
+ if effect == "moveFromRight" then
+
+ nextView.x = display.contentWidth
+ nextView.y = 0
+ --
+ loadScene (nextScene)
+ --
+ showFx = transition.to ( nextView, { x=0, time=fxTime } )
+ showFx = transition.to ( currentView, { x=display.contentWidth*-1, time=fxTime } )
+ --
+ timer.performWithDelay( fxTime, fxEnded )
+
+ -----------------------------------
+ -- EFFECT: Over From Right
+ -----------------------------------
+
+ elseif effect == "overFromRight" then
+
+ nextView.x = display.contentWidth
+ nextView.y = 0
+ --
+ loadScene (nextScene)
+ --
+ showFx = transition.to ( nextView, { x=0, time=fxTime } )
+ --
+ timer.performWithDelay( fxTime, fxEnded )
+
+ -----------------------------------
+ -- EFFECT: Move From Left
+ -----------------------------------
+
+ elseif effect == "moveFromLeft" then
+
+ nextView.x = display.contentWidth*-1
+ nextView.y = 0
+ --
+ loadScene (nextScene)
+ --
+ showFx = transition.to ( nextView, { x=0, time=fxTime } )
+ showFx = transition.to ( currentView, { x=display.contentWidth, time=fxTime } )
+ --
+ timer.performWithDelay( fxTime, fxEnded )
+
+ -----------------------------------
+ -- EFFECT: Over From Left
+ -----------------------------------
+
+ elseif effect == "overFromLeft" then
+
+ nextView.x = display.contentWidth*-1
+ nextView.y = 0
+ --
+ loadScene (nextScene)
+ --
+ showFx = transition.to ( nextView, { x=0, time=fxTime } )
+ --
+ timer.performWithDelay( fxTime, fxEnded )
+
+ -----------------------------------
+ -- EFFECT: Over From Top
+ -----------------------------------
+
+ elseif effect == "overFromTop" then
+
+ nextView.x = 0
+ nextView.y = display.contentHeight*-1
+ --
+ loadScene (nextScene)
+ --
+ showFx = transition.to ( nextView, { y=0, time=fxTime } )
+ --
+ timer.performWithDelay( fxTime, fxEnded )
+
+ -----------------------------------
+ -- EFFECT: Over From Bottom
+ -----------------------------------
+
+ elseif effect == "overFromBottom" then
+
+ nextView.x = 0
+ nextView.y = display.contentHeight
+ --
+ loadScene (nextScene)
+ --
+ showFx = transition.to ( nextView, { y=0, time=fxTime } )
+ --
+ timer.performWithDelay( fxTime, fxEnded )
+
+ -----------------------------------
+ -- EFFECT: Fade
+ -----------------------------------
+ -- ARG1 = color [string]
+ -----------------------------------
+ -- ARG1 = red [number]
+ -- ARG2 = green [number]
+ -- ARG3 = blue [number]
+ -----------------------------------
+
+ elseif effect == "fade" then
+
+ local r, g, b
+ --
+ if type(arg1) == "nil" then
+ arg1 = "black"
+ end
+ --
+ if string.lower(arg1) == "red" then
+ r=255
+ g=0
+ b=0
+ elseif string.lower(arg1) == "green" then
+ r=0
+ g=255
+ b=0
+ elseif string.lower(arg1) == "blue" then
+ r=0
+ g=0
+ b=255
+ elseif string.lower(arg1) == "yellow" then
+ r=255
+ g=255
+ b=0
+ elseif string.lower(arg1) == "pink" then
+ r=255
+ g=0
+ b=255
+ elseif string.lower(arg1) == "white" then
+ r=255
+ g=255
+ b=255
+ elseif type (arg1) == "number"
+ and type (arg2) == "number"
+ and type (arg3) == "number" then
+ r=arg1
+ g=arg2
+ b=arg3
+ else
+ r=0
+ g=0
+ b=0
+ end
+ --
+ nextView.x = display.contentWidth
+ nextView.y = 0
+ --
+ loadScene (nextScene)
+ --
+ local fade = display.newRect( 0 - display.contentWidth, 0 - display.contentHeight, display.contentWidth * 3, display.contentHeight * 3 )
+ fade.alpha = 0
+ fade:setFillColor( r,g,b )
+ effectView:insert(fade)
+ --
+ showFx = transition.to ( fade, { alpha=1.0, time=fxTime } )
+ --
+ timer.performWithDelay( fxTime, fxEnded )
+ --
+ local function returnFade ( event )
+
+ showFx = transition.to ( fade, { alpha=0, time=fxTime } )
+ --
+ local function removeFade ( event )
+ fade:removeSelf()
+ end
+ --
+ timer.performWithDelay( fxTime, removeFade )
+
+ end
+ --
+ timer.performWithDelay( fxTime+1, returnFade )
+
+ -----------------------------------
+ -- EFFECT: Flip
+ -----------------------------------
+
+ elseif effect == "flip" then
+
+ showFx = transition.to ( currentView, { xScale=0.001, time=fxTime } )
+ showFx = transition.to ( currentView, { x=display.contentWidth*0.5, time=fxTime } )
+ --
+ loadScene (nextScene)
+ --
+ nextView.xScale=0.001
+ nextView.x=display.contentWidth*0.5
+ --
+ showFx = transition.to ( nextView, { xScale=1, delay=fxTime, time=fxTime } )
+ showFx = transition.to ( nextView, { x=0, delay=fxTime, time=fxTime } )
+ --
+ timer.performWithDelay( fxTime*2, fxEnded )
+
+ -----------------------------------
+ -- EFFECT: Down Flip
+ -----------------------------------
+
+ elseif effect == "downFlip" then
+
+ showFx = transition.to ( currentView, { xScale=0.7, time=fxTime } )
+ showFx = transition.to ( currentView, { yScale=0.7, time=fxTime } )
+ showFx = transition.to ( currentView, { x=display.contentWidth*0.15, time=fxTime } )
+ showFx = transition.to ( currentView, { y=display.contentHeight*0.15, time=fxTime } )
+ showFx = transition.to ( currentView, { xScale=0.001, delay=fxTime, time=fxTime } )
+ showFx = transition.to ( currentView, { x=display.contentWidth*0.5, delay=fxTime, time=fxTime } )
+ --
+ loadScene (nextScene)
+ --
+ nextView.x = display.contentWidth*0.5
+ nextView.xScale=0.001
+ nextView.yScale=0.7
+ nextView.y=display.contentHeight*0.15
+ --
+ showFx = transition.to ( nextView, { x=display.contentWidth*0.15, delay=fxTime*2, time=fxTime } )
+ showFx = transition.to ( nextView, { xScale=0.7, delay=fxTime*2, time=fxTime } )
+ showFx = transition.to ( nextView, { xScale=1, delay=fxTime*3, time=fxTime } )
+ showFx = transition.to ( nextView, { yScale=1, delay=fxTime*3, time=fxTime } )
+ showFx = transition.to ( nextView, { x=0, delay=fxTime*3, time=fxTime } )
+ showFx = transition.to ( nextView, { y=0, delay=fxTime*3, time=fxTime } )
+ --
+ timer.performWithDelay( fxTime*4, fxEnded )
+
+ -----------------------------------
+ -- EFFECT: None
+ -----------------------------------
+
+ else
+ timer.performWithDelay( 0, fxEnded )
+ loadScene (nextScene)
+ end
+
+ -----------------------------------
+ -- Clean up memory
+ -----------------------------------
+
+ if lastScene then
+ -- Custom clean function (unloadMe)
+ if string.lower(lastScene) ~= "main" then
+ package.loaded[lastScene].unloadMe()
+ end
+ package.loaded[lastScene] = nil
+ end
+ -- if lastScene then
+ -- package.loaded[lastScene] = nil
+ -- end
+ lastScene = nextScene
+ collectgarbage("collect")
+
+ return true
+end
View
104 generate.rb
@@ -0,0 +1,104 @@
+require 'json'
+
+MENU_CODE = %{
+ local #<name>Button = display.newImage("images/buttons/#<name>.png")
+ local function #<name>Pressed ( event )
+ if event.phase == "ended" then
+ #<change_scene_code>
+ end
+ end
+ #<name>Button:addEventListener("touch", #<name>Pressed)
+ #<name>Button.x = #<x>
+ #<name>Button.y = #<y>
+ localGroup:insert(#<name>Button)
+
+}
+
+def generate_menu_code_for(menu_item)
+ button_transition = menu_item['transition'][0]
+ button_transition_options = menu_item['transition'][1..-1]
+ if button_transition_options.empty?
+ change_scene_code = %{director:changeScene("#{menu_item['name']}", "#{button_transition}")}
+ else
+ transition_options = button_transition_options.collect do |o|
+ begin
+ Float(o)
+ rescue
+ %{"#{o}"}
+ end
+ end.join(',')
+ change_scene_code = %{director:changeScene("#{menu_item['name']}", "#{button_transition}", #{transition_options})}
+ end
+ menu_code = MENU_CODE.clone
+ menu_code.gsub!('#<name>', menu_item['name'])
+ menu_code.gsub!('#<x>', menu_item['x'].to_s)
+ menu_code.gsub!('#<y>', menu_item['y'].to_s)
+ menu_code.gsub!('#<change_scene_code>', change_scene_code)
+ menu_code
+end
+
+# Load the template
+template = DATA.readlines
+
+# Read the menu.txt file
+menu_file = File.open('menu.json', 'r')
+menu = JSON.parse(menu_file.readlines.join(' '))
+
+# Generate the screen .lua file
+menu.each do |screen|
+ screen_file = File.new("#{screen['name']}.lua", 'w+')
+ template.each do |l|
+ screen_file.print l
+ end
+ screen_file.close
+end
+
+# Update menu.lua
+# Read the entire file into memory, insert the generated code, then overwrite the existing menu.lua
+menu_lua_file = File.open('menu.lua', 'r+')
+menu_lua_file_lines = menu_lua_file.readlines
+menu_lua_file.close
+menu_lua_file = File.open('menu.lua', 'w+')
+menu_lua_file_lines.each do |line|
+ menu_lua_file.print line
+ if line.include?("-- Menu Buttons - Start") # Look for the start markup
+ menu.each do |menu_item|
+ menu_lua_file.print generate_menu_code_for menu_item
+ end
+ end
+end
+menu_lua_file.close
+
+__END__
+module(..., package.seeall)
+
+-- Main function - MUST return a display.newGroup()
+function new()
+ local localGroup = display.newGroup()
+
+ -- Background
+ local background = display.newImage("images/backgrounds/menu.png")
+ localGroup:insert(background)
+
+ -- Title
+ local title = display.newText("Touch to go back", 0, 0, native.systemFontBold, 16)
+ title:setTextColor( 255,255,255)
+ title.x = 160
+ title.y = 240
+ title.name = "title"
+ localGroup:insert(title)
+
+ -- Touch to go back
+ local function touched ( event )
+ if event.phase == "ended" then
+ director:changeScene("menu","fade")
+ end
+ end
+ background:addEventListener("touch",touched)
+
+ unloadMe = function()
+ end
+
+ -- MUST return a display.newGroup()
+ return localGroup
+end
View
191 generate.rbc
@@ -0,0 +1,191 @@
+!RBIX
+0
+x
+M
+1
+n
+n
+x
+10
+__script__
+i
+77
+99
+65
+49
+0
+0
+7
+1
+49
+2
+2
+15
+5
+7
+3
+64
+47
+49
+4
+1
+15
+45
+5
+6
+7
+7
+64
+7
+8
+64
+49
+9
+2
+19
+0
+15
+45
+10
+11
+20
+0
+49
+12
+0
+7
+13
+64
+49
+14
+1
+49
+15
+1
+19
+1
+15
+5
+20
+1
+49
+16
+0
+47
+49
+17
+1
+15
+45
+18
+19
+49
+12
+0
+19
+2
+15
+2
+11
+I
+6
+I
+3
+I
+0
+I
+0
+n
+p
+20
+x
+9
+data_path
+I
+cd
+x
+8
+set_data
+s
+4
+json
+x
+7
+require
+x
+4
+File
+n
+s
+9
+menu.json
+s
+1
+r
+x
+4
+open
+x
+4
+JSON
+n
+x
+9
+readlines
+s
+1
+
+x
+4
+join
+x
+5
+parse
+x
+7
+inspect
+x
+5
+print
+x
+4
+DATA
+n
+p
+11
+I
+b
+I
+1
+I
+14
+I
+4
+I
+23
+I
+5
+I
+37
+I
+6
+I
+42
+I
+a
+I
+4d
+x
+70
+/Users/rad/Documents/projects/nvinium/corona-game-template/generate.rb
+p
+3
+x
+9
+menu_file
+x
+4
+menu
+x
+8
+template
View
32 help.lua
@@ -0,0 +1,32 @@
+module(..., package.seeall)
+
+-- Main function - MUST return a display.newGroup()
+function new()
+ local localGroup = display.newGroup()
+
+ -- Background
+ local background = display.newImage("images/backgrounds/menu.png")
+ localGroup:insert(background)
+
+ -- Title
+ local title = display.newText("Touch to go back", 0, 0, native.systemFontBold, 16)
+ title:setTextColor( 255,255,255)
+ title.x = 160
+ title.y = 240
+ title.name = "title"
+ localGroup:insert(title)
+
+ -- Touch to go back
+ local function touched ( event )
+ if event.phase == "ended" then
+ director:changeScene("menu","fade")
+ end
+ end
+ background:addEventListener("touch",touched)
+
+ unloadMe = function()
+ end
+
+ -- MUST return a display.newGroup()
+ return localGroup
+end
View
BIN images/backgrounds/menu.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/buttons/about.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/buttons/help.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/buttons/play.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/buttons/settings.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN images/splashScreen.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
34 loadmenu.lua
@@ -0,0 +1,34 @@
+--
+-- adapted from Ghosts Vs Monsters sample project
+-- (see http://blog.anscamobile.com/2010/12/ghosts-vs-monsters-open-source-game-in-corona-sdk/)
+--
+
+module(..., package.seeall)
+
+-- Main function - MUST return a display.newGroup()
+function new()
+ local localGroup = display.newGroup()
+
+ local theTimer
+ local loadingImage
+
+ local showLoadingScreen = function()
+ loadingImage = display.newImageRect( "images/splashScreen.png", 480, 346 )
+ loadingImage.x = 240; loadingImage.y = 173
+ localGroup:insert(loadingImage)
+
+ local goToLevel = function()
+ director:changeScene( "menu" )
+ end
+
+ theTimer = timer.performWithDelay( 1000, goToLevel, 1 )
+ end
+
+ showLoadingScreen()
+
+ unloadMe = function()
+ end
+
+ -- MUST return a display.newGroup()
+ return localGroup
+end
View
12 main.lua
@@ -0,0 +1,12 @@
+display.setStatusBar( display.HiddenStatusBar )
+
+local director = require("director")
+local mainGroup = display.newGroup()
+
+local function main()
+ mainGroup:insert(director.directorView)
+ director:changeScene("loadmenu")
+ return true
+end
+
+main()
View
26 menu.json
@@ -0,0 +1,26 @@
+[
+ {
+ "name":"play",
+ "x":160,
+ "y":80,
+ "transition":["fade", 30, 60, 90]
+ },
+ {
+ "name":"settings",
+ "x":160,
+ "y":130,
+ "transition":["fade", "green"]
+ },
+ {
+ "name":"help",
+ "x":160,
+ "y":180,
+ "transition":["overFromTop"]
+ },
+ {
+ "name":"about",
+ "x":160,
+ "y":230,
+ "transition":["moveFromLeft"]
+ }
+]
View
67 menu.lua
@@ -0,0 +1,67 @@
+module(..., package.seeall)
+
+-- Main function - MUST return a display.newGroup()
+function new()
+ local localGroup = display.newGroup()
+
+ -- Background
+ local background = display.newImage("images/backgrounds/menu.png")
+ localGroup:insert(background)
+
+ -- Menu Buttons - Start
+
+ local playButton = display.newImage("images/buttons/play.png")
+ local function playPressed ( event )
+ if event.phase == "ended" then
+ director:changeScene("play", "fade", 30.0,60.0,90.0)
+ end
+ end
+ playButton:addEventListener("touch", playPressed)
+ playButton.x = 160
+ playButton.y = 80
+ localGroup:insert(playButton)
+
+
+ local settingsButton = display.newImage("images/buttons/settings.png")
+ local function settingsPressed ( event )
+ if event.phase == "ended" then
+ director:changeScene("settings", "fade", "green")
+ end
+ end
+ settingsButton:addEventListener("touch", settingsPressed)
+ settingsButton.x = 160
+ settingsButton.y = 130
+ localGroup:insert(settingsButton)
+
+
+ local helpButton = display.newImage("images/buttons/help.png")
+ local function helpPressed ( event )
+ if event.phase == "ended" then
+ director:changeScene("help", "overFromTop")
+ end
+ end
+ helpButton:addEventListener("touch", helpPressed)
+ helpButton.x = 160
+ helpButton.y = 180
+ localGroup:insert(helpButton)
+
+
+ local aboutButton = display.newImage("images/buttons/about.png")
+ local function aboutPressed ( event )
+ if event.phase == "ended" then
+ director:changeScene("about", "moveFromLeft")
+ end
+ end
+ aboutButton:addEventListener("touch", aboutPressed)
+ aboutButton.x = 160
+ aboutButton.y = 230
+ localGroup:insert(aboutButton)
+
+ -- Menu Buttons - End
+
+ unloadMe = function()
+ end
+
+ -- MUST return a display.newGroup()
+ return localGroup
+end
View
32 play.lua
@@ -0,0 +1,32 @@
+module(..., package.seeall)
+
+-- Main function - MUST return a display.newGroup()
+function new()
+ local localGroup = display.newGroup()
+
+ -- Background
+ local background = display.newImage("images/backgrounds/menu.png")
+ localGroup:insert(background)
+
+ -- Title
+ local title = display.newText("Touch to go back", 0, 0, native.systemFontBold, 16)
+ title:setTextColor( 255,255,255)
+ title.x = 160
+ title.y = 240
+ title.name = "title"
+ localGroup:insert(title)
+
+ -- Touch to go back
+ local function touched ( event )
+ if event.phase == "ended" then
+ director:changeScene("menu","fade")
+ end
+ end
+ background:addEventListener("touch",touched)
+
+ unloadMe = function()
+ end
+
+ -- MUST return a display.newGroup()
+ return localGroup
+end
View
32 settings.lua
@@ -0,0 +1,32 @@
+module(..., package.seeall)
+
+-- Main function - MUST return a display.newGroup()
+function new()
+ local localGroup = display.newGroup()
+
+ -- Background
+ local background = display.newImage("images/backgrounds/menu.png")
+ localGroup:insert(background)
+
+ -- Title
+ local title = display.newText("Touch to go back", 0, 0, native.systemFontBold, 16)
+ title:setTextColor( 255,255,255)
+ title.x = 160
+ title.y = 240
+ title.name = "title"
+ localGroup:insert(title)
+
+ -- Touch to go back
+ local function touched ( event )
+ if event.phase == "ended" then
+ director:changeScene("menu","fade")
+ end
+ end
+ background:addEventListener("touch",touched)
+
+ unloadMe = function()
+ end
+
+ -- MUST return a display.newGroup()
+ return localGroup
+end

0 comments on commit 61f2feb

Please sign in to comment.