-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
57 lines (47 loc) · 1.06 KB
/
main.lua
File metadata and controls
57 lines (47 loc) · 1.06 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
-- Globals
dbg = require'utils.dbg'
inspect = dbg.inspect
require'SETTINGS'
local colors = require'modules.color'
local Game = require'Game'
local Key = SETTINGS.Key
local game
function love.load()
dbg.print'Panetone > Chocotone'
dbg.print(_VERSION)
dbg.inspect{SETTINGS, 'SETTINGS'}
dbg.print()
dbg.log.load'main'
love.graphics.setDefaultFilter('nearest', 'nearest', 0)
love.graphics.setBackgroundColor(colors.OCEAN)
love.window.setTitle'Space Invaders'
love.window.setMode(
256 * 2, 240 * 2,
{
msaa = 0,
resizable = true,
borderless = false,
}
)
Game:load()
game = Game()
dbg.log.loaded'main'
dbg.print()
end
function love.draw()
game:draw()
end
function love.update(dt)
Key:update(dt)
game:keydown()
game:update(dt)
end
function love.keypressed(key)
-- Restart key is tested here
-- So it's easy to create a new game
if key == 'r' then
dbg.print 'Restart'
game.hud:updateHighscore()
game = Game()
end
end