-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
46 lines (39 loc) · 881 Bytes
/
main.lua
File metadata and controls
46 lines (39 loc) · 881 Bytes
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
love = require('love')
require('screens')
require("tools")
function love.load()
-- save the pixels
love.graphics.setDefaultFilter("nearest", "nearest")
windowHeight = love.graphics.getHeight()
windowWidth = love.graphics.getWidth()
windowCenterX = windowWidth / 2 / Scale
windowCenterY = windowHeight / 2 / Scale
GameState = "menu"
_upd = upd_menu
_drw = drw_menu
end
function love.update(dt)
_upd(dt)
end
function love.draw()
-- scale pixels up before everything draws
love.graphics.scale(Scale,Scale)
_drw()
end
function love.keypressed(key)
if key == 'escape' then love.event.quit() end
if GameState == "menu" then
if key == 'space' then
GameState = "game"
load_game()
_upd = upd_game
_drw = drw_game
end
elseif GameState == "game" then
if key == "return" then
_upd = upd_menu
_drw = drw_menu
GameState = "menu"
end
end
end