-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
106 lines (88 loc) · 1.94 KB
/
Copy pathmain.lua
File metadata and controls
106 lines (88 loc) · 1.94 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
knight = require 'vendor.knight'
class = require 'vendor.middleclass'
_ = require 'vendor.underscore'
require 'vendor.AnAL'
tween = require 'vendor.tween'
-- Some global helper methods
inspect = require 'vendor.inspect'
function p(val)
print(inspect(val))
end
FixtureCategory = {
player = 1,
feet = 2,
bad_guy = 3,
piece = 4,
wall = 5,
ghost_wall = 6,
effect = 7
}
_.each({
'event_listener',
'event',
'world',
'palette',
'player',
'entity',
'map',
'platform',
'floaty_platform',
'badguy',
'birdguy',
'screen_pieces',
'images',
'animation_collection',
'feet',
'darkness',
'text',
'slope',
'window',
'audio',
'ghost_wall',
'highscores',
'clock',
'puff'
}, function(dep)
require('src.' .. dep)
end)
local width, height = 512, 376
local scale = 2
knight.module("Game").require({"event", "palette"}, function(event, palette)
function love.load()
love.graphics.setBackgroundColor(unpack(palette.black))
love.window.setMode(width*scale, height*scale)
love.graphics.setDefaultFilter('nearest', 'nearest', 1)
event:trigger("load")
end
function love.draw()
love.graphics.scale(scale, scale)
event:trigger("draw_stencil")
love.graphics.setColor(palette.grey1)
love.graphics.rectangle("fill", 0, 0, width, height)
event:trigger("draw")
love.graphics.setStencil()
event:trigger("draw_overlay")
end
function love.update(dt)
event:trigger("update", dt)
end
function love.keypressed(key)
event:trigger("keypressed", key)
end
function love.keyreleased(key)
event:trigger("keyreleased", key)
if key == 'escape' then love.event.quit() end
end
function love.mousepressed(x, y, button)
event:trigger("mousepressed", x, y, button)
end
function love.mousereleased(x, y, button)
event:trigger("mousereleased", x, y, button)
end
function love.focus(focus)
event:trigger("focus", focus)
end
function love.quit()
event:trigger("quit")
end
end)