--LoadModules()
SetPlayerControl(1)
zspawncount=10

defaultlevel="level1" 	-- ei tea kas seda enam vaja ongi

--main menu:
--------------------------------------
playmenu=menu.AddItem(menu.GetRoot(),"Play") 
optsmenu=menu.AddItem(menu.GetRoot(),"Options")
infomenu=menu.AddItem(menu.GetRoot(),"Info")

helpmenu=menu.AddItem(infomenu,"Items",function() menu.SetState("itemhelp") end)
helpmenu=menu.AddItem(infomenu,"Monsters",function() menu.SetState("enemyhelp") end)
helpmenu=menu.AddItem(infomenu,"Story",function() menu.SetState("storyhelp") end)
statmenu=menu.AddItem(infomenu,"Stats",function() menu.SetState("stats") end)
statmenu=menu.AddItem(infomenu,"Credits",function() menu.SetState("credits") end)
helpmenu=menu.AddItem(infomenu,"Intro",function() menu.SetState("intro") end)
exitmenu=menu.AddItem(menu.GetRoot(),"Exit",function() ExitGame() end)


--play menu:
--------------------------------------
--menu.AddItem(playmenu,"testlevel", function() LoadLevel("testlevel",0) menu.SetState("game") end)
menu.AddItem(playmenu,"tutorial", function() LoadLevel("tutorial",0) menu.SetState("game") end)
menu.AddItem(playmenu,"level1", function() LoadLevel("level1",0) menu.SetState("game") end)

level3i=menu.AddItem(playmenu,"level3", function() LoadLevel("level3",0) menu.SetState("game") end) 
if progress.level3==0 then 
	menu.DisableItem(level3i)
	menu.SetItemText(level3i,"Finish level 5 to unlock")
end

level5i=menu.AddItem(playmenu,"level5", function() LoadLevel("level5",0) menu.SetState("game") end) 
if progress.level5==0 then 
	menu.DisableItem(level5i)
	menu.SetItemText(level5i,"Reach level 7 to unlock")
end

level7i=menu.AddItem(playmenu,"level7", function() LoadLevel("level7",0) menu.SetState("game") end) 
if progress.level7==0 then 
	menu.DisableItem(level7i)
	menu.SetItemText(level7i,"Reach level 9 to unlock")
end

level9i=menu.AddItem(playmenu,"level9", function() LoadLevel("level9",0) menu.SetState("game") end) 
if progress.level9==0 then 
	menu.DisableItem(level9i)
	menu.SetItemText(level9i,"Finish the game unlock")
end

--options menu:
--------------------------------------
optvalues={[false]="OFF",[true]="ON"}
distvalues={[false]="VERTEX",[true]="PIXEL"}

menu.AddItem(optsmenu,"Controls",function() menu.SetState("controls") end)

vzoommenuitem=menu.AddItem(optsmenu,"View zoom: "..optvalues[settings.viewzoom],function() 
	settings.viewzoom=not settings.viewzoom
	menu.RenameItem(vzoommenuitem,"View zoom: "..optvalues[settings.viewzoom] )
end)

distmenuitem=menu.AddItem(optsmenu,"Distortion: "..distvalues[settings.pixeldistortion],function() 
	settings.pixeldistortion=not settings.pixeldistortion
	menu.RenameItem(distmenuitem,"Distortion: "..distvalues[settings.pixeldistortion] )
end)

mname="test"							

menu.SetState("intro")
SetVolume(100)
