-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHome.lua
More file actions
65 lines (51 loc) · 1.19 KB
/
Copy pathHome.lua
File metadata and controls
65 lines (51 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
local selection = 1
function menu_load()
love.graphics.setBackgroundColor(75,0,130)
menuButton={}
menuButton[1]={text="Start Game",x=300,y=300,execute=startGame}
menuButton[2]={text="Exit Game",x=300,y=400,execute=endGame}
end
function menu_draw()
love.graphics.setFont(titlefont)
love.graphics.setColor(255, 255, 255)
love.graphics.printf("DEEP SPACE",200,100,400,"center")
love.graphics.setFont(buttonfont)
for i,v in ipairs(menuButton) do
if i == selection then
love.graphics.setColor(255, 255, 255)
love.graphics.printf(v.text,v.x,v.y,200,"center")
else
love.graphics.setColor(64, 64, 180)
love.graphics.printf(v.text,v.x,v.y,200,"center")
end
end
end
function menu_update(dt)
-- body
end
function menu_keyboard(key)
if key == "up" then
selection = selection - 1
if selection == 0 then
selection =#menuButton
end
end
if key == "down" then
selection = (selection + 1)
if selection > #menuButton then
selection = 1
end
end
if key == "return" then
menuButton[selection].execute()
end
end
function startGame()
game_load()
gamestate="Game"
print("Starting game")
end
function endGame()
print("Quitting")
love.event.push("quit")
end