Have a look at this, i threw it together on my lunch break.
I will try and go back and comment some of the code but it should make a bit of sense
Note - only first words button works.
[lua]-- save as main.lua
_W = display.contentWidth / 2
_H = display.contentHeight / 2
function mainMenu()
mainMenuDisplayGroup = display.newGroup()
headerText = display.newText(“Beginners”, 0, 0, native.systemFontBold, 24)
headerText:setReferencePoint(display.CenterReferencePoint)
headerText.x = _W
headerText.y = _H - 200
headerText:setTextColor(255, 0, 0)
firstwordsRect = display.newRect(0, 0, 310,20)
firstwordsRect:setFillColor(100, 150, 255)
firstwordsRect.x = _W
firstwordsRect.y = _H - 160
firstwordsRect.name = “firstwordsBTN”
firstwordsText = display.newText(“First Words”, 0, 0, native.systemFont, 20)
firstwordsText:setReferencePoint(display.CenterLeftReferencePoint)
firstwordsText.x = _W - 150
firstwordsText.y = _H - 160
firstwordsText:setTextColor(255, 0, 0)
foodRect = display.newRect(0, 0, 310,20)
foodRect:setFillColor(100, 150, 255)
foodRect.x = _W
foodRect.y = _H - 130
foodText = display.newText(“Food”, 0, 0, native.systemFont, 20)
foodText:setReferencePoint(display.CenterLeftReferencePoint)
foodText.x = _W - 150
foodText.y = _H - 130
foodText:setTextColor(255, 0, 0)
mainMenuDisplayGroup:insert( headerText )
mainMenuDisplayGroup:insert( firstwordsRect )
mainMenuDisplayGroup:insert( firstwordsText )
mainMenuDisplayGroup:insert( foodRect )
mainMenuDisplayGroup:insert( foodText )
firstwordsRect:addEventListener(“tap”, menuTween)
end
function firstwordsMenu()
firstwordsMenuDisplayGroup = display.newGroup()
headerText = display.newText(“First Words”, 0, 0, native.systemFontBold, 24)
headerText:setReferencePoint(display.CenterReferencePoint)
headerText.x = _W
headerText.y = _H - 200
headerText:setTextColor(255, 0, 0)
backgroundRect = display.newRect(0, 0, 320,480)
backgroundRect:setFillColor(100, 150, 255)
backgroundRect.x = _W
backgroundRect.y = _H
line1Text = display.newText(“Today = Kin a dit”, 0, 0, native.systemFont, 20)
line1Text:setReferencePoint(display.CenterLeftReferencePoint)
line1Text.x = _W - 150
line1Text.y = _H - 160
line1Text:setTextColor(255, 0, 0)
line2Text = display.newText(“Tomorrow = Bin a dit”, 0, 0, native.systemFont, 20)
line2Text:setReferencePoint(display.CenterLeftReferencePoint)
line2Text.x = _W - 150
line2Text.y = _H - 130
line2Text:setTextColor(255, 0, 0)
backText = display.newText(“Tap to go Back”, 0, 0, native.systemFont, 20)
backText.x = _W
backText.y = _H
backText:setTextColor(255, 0, 0)
backText.name = “backBTN”
firstwordsMenuDisplayGroup:insert( backgroundRect )
firstwordsMenuDisplayGroup:insert( headerText )
firstwordsMenuDisplayGroup:insert( line1Text )
firstwordsMenuDisplayGroup:insert( line2Text )
firstwordsMenuDisplayGroup:insert( backText )
backText:addEventListener(“tap”, menuTween)
end
function menuTween(event)
if event.target.name == “firstwordsBTN” then
transition.to(mainMenuDisplayGroup,{time = 750, alpha = 0,transition = easing.inlinear, onComplete = firstwordsMenu})
firstwordsRect:removeEventListener(“tap”, menuTween)
elseif event.target.name == “backBTN” then
transition.to(firstwordsMenuDisplayGroup,{time = 750, alpha = 0,transition = easing.inlinear, onComplete = mainMenu})
backText:removeEventListener(“tap”, menuTween)
end
end
mainMenu()[/lua]
Config:
[lua]-- save as config.lua
application =
{
content =
{
width = 320,
height = 480,
scale = “letterbox”,
fps = 60,
antialias = true,
xalign = “center”,
yalign = “center”,
imageSuffix =
{
["@2x"] = 2,
},
},
}[/lua]
[import]uid: 62706 topic_id: 30554 reply_id: 122417[/import]