main.lua:
print();print("");print()
-- HIDE THE STATUS BAR
display.setStatusBar( display.HiddenStatusBar )
-- Import director class
local director = require("director")
-- The main group
local mainGroup = display.newGroup()
-- The main function
local function main()
-- Add the group from director class
mainGroup:insert(director.directorView)
-- Change scene to mainmenu
director:changeScene("mainmenu", "fade")
return true
end
-- Start!"#!"#!"
main()
mainmenu.lua:
module(..., package.seeall)
-- Main function - MUST return a display.newGroup()
function new()
local localGroup = display.newGroup()
mainmenuText = display.newText("main menu", 50,50,system.defaultFont, 50)
mainmenuText.x = 500
mainmenuText.y = 500
localGroup:insert(mainmenuText)
----FUNCTIONS
function levelmenu(event)
if event.phase == "ended" then
director:changeScene("levelmenu")
end
end
----ADD EVENT LISTENERS
mainmenuText:addEventListener("touch", levelmenu)
-- MUST return a display.newGroup()
return localGroup
end
levelmenu.lua:
module(..., package.seeall)
-- Main function - MUST return a display.newGroup()
function new()
local localGroup = display.newGroup()
levelmenuText = display.newText("level menu", 50,50,system.defaultFont, 50)
levelmenuText.x = 500
levelmenuText.y = 500
localGroup:insert(levelmenuText)
----FUNCTIONS
function myLevel()
director:changeScene("myLevel")
end
----ADD EVENT LISTENERS
Runtime:addEventListener("touch", myLevel)
return localGroup
end
myLevel.lua:
[code]
module(…, package.seeall)
– Main function - MUST return a display.newGroup()
function new()
local localGroup = display.newGroup()
local level = require(“level”)
localGroup:insert(level.localGroup)
function startTest()
director:changeScene(“mainmenu”)
end
myLevelText = display.newText(“myLevel”, 50,50,system.defaultFont, 50)
myLevelText.x = 500
myLevelText.y = 500
localGroup:insert(myLevelText)
myLevelText:addEventListener(“touch”, startTest)
– MUST return a display.newGroup()
return localGroup
end
[/code] [import]uid: 24111 topic_id: 12465 reply_id: 45610[/import]