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
|
STRICT = true
DEBUG = true
require 'zoetrope'
deque = require 'deque'
require 'version'
require 'player'
require 'notplayer'
GameView = View:extend {
onNew = function (self)
--self:loadLayers('data/map.lua')
--self.focus = the.player
--self:clampTo(self.bg)
the.player = Player:new{
x = math.random(the.app.width),
y = math.random(the.app.height),
}
self:add(the.player)
the.notplayers = Group:new()
self:add(the.notplayers)
for _ = 1, 14 do
the.notplayers:add(NotPlayer:new {
x = math.random(the.app.width),
y = math.random(the.app.height),
})
end
end,
onUpdate = function(self, dt)
if the.player.moved then
-- this should encapsulate
for _, np in ipairs(the.notplayers.sprites) do
np:doMove()
end
the.player.moved = false
end
if the.keys:justPressed('escape', 'q') then
the.app:quit()
end
end,
}
the.app = App:new {
name = "LD28",
onRun = function (self)
print('Version: ' .. VERSION)
self.view = GameView:new()
if DEBUG then
self.console:watch('VERSION', 'VERSION')
-- back off that dark overlay a bit
self.console.fill.fill[4] = 75
end
end,
}
|