Game Template Wanted: Angry Bird Level Structure/Menu

I know there are a lot of game templates out there. Is anyone aware of one (paid or otherwise) that provides a level selection scheme like angry birds? By this I mean the ability to initially display a locked graphic for each level not yet completed and… then unlock each level as it is completed. Perhapse even display a number of stars to indicate how well the player did on the level.
Thanks!
Tim [import]uid: 16901 topic_id: 20399 reply_id: 320399[/import]

It’s very easy. This code come from my olllldd game :slight_smile: First you need some data container:

[lua]require “sqlite3”
require “toggle”

local path = system.pathForFile(“thegolfwar.db”, system.DocumentsDirectory)
db = sqlite3.open( path )

local function onSystemEvent( event )
if( event.type == “applicationExit” ) then
db:close()
end
end

–Setup the table if it doesn’t exist
local tablesetup = [[CREATE TABLE IF NOT EXISTS audio (id INTEGER PRIMARY KEY, wartosc);]]
local pointsStore = [[CREATE TABLE IF NOT EXISTS points (id INTEGER PRIMARY KEY, current, best);]]
db:exec( tablesetup )
db:exec( pointsStore )

–First time sound init
local soundInit = function()
local row_inConfig_count = 0
for row in db:nrows(‘SELECT * FROM audio’) do
row_inConfig_count = row_inConfig_count + 1
end

local audioStartConfig = [[INSERT INTO audio VALUES(1, 1);]]

if (row_inConfig_count == 0) then
db:exec( audioStartConfig )
for i=1,36 do
local pointsStoreInit = [[INSERT INTO points VALUES(’]]…i…[[’, 0, 0);]]
db:exec( pointsStoreInit )
end
end
end[/lua]

and next something like this:

[lua]local selectLevelBtn = function( event )
if event.phase == “release” then
if ( event.id > 12 ) then
local alert = native.showAlert( “The Golf War Lite”, “Coming soon!”,
{ “OK” }, onAlertComplete )
else
audio.play( GameSounds[3] )
director:changeScene(“loadlevel”…event.id, “overFromRight”)
end
end
end

local i = 1
local j = 1
local addx = 0

for row in db:nrows(‘SELECT * FROM points’) do
local currentObject

if row.best > 0 then currentObject = “mision-on.png”
else currentObject = “mision-off.png”
end

local LevelBtn = “Button”…row.id
LevelBtn = ui.newButton{
defaultSrc = currentObject,
defaultX = 64,
defaultY = 64,
overSrc = currentObject,
overX = 64,
overY = 64,
id = row.id,
onEvent = selectLevelBtn,
text = “”,
font = “Helvetica”,
textColor = { 255, 255, 255, 255 },
size = 16,
emboss = false
}

LevelBtn.x = (i*68) + addx
LevelBtn.y = 30 + (j*78)
localGroup:insert( LevelBtn )

local currentText = “currentText”…row.id
currentText = display.newText( row.id, ((i*68) + addx) - 5 , 50 + (j*78), “HZHandwrite”, 32 )
currentText:setTextColor( 0, 0, 0 )
localGroup:insert( currentText )

i = i + 1
if ( row.id % 6 == 0 ) then
j = j + 1
i = 1
if j > 3 then
addx = 480
j = 1
end
end
end[/lua] [import]uid: 12704 topic_id: 20399 reply_id: 79782[/import]

Thanks gtatarkin! I appreciate you taking the time to share that.
Tim [import]uid: 16901 topic_id: 20399 reply_id: 79809[/import]

thanks gata ,it’s great for me. [import]uid: 22631 topic_id: 20399 reply_id: 82169[/import]