5
deque = require 'deque'
6
--inspect = require 'inspect'
14
GameView = View:extend {
15
onNew = function (self)
16
self:loadLayers('data/map.lua')
18
the.player = Player:new{
19
x = math.random(the.app.width),
20
y = math.random(the.app.height),
24
the.clones = Group:new()
27
the.clones:add(Clone:new {
28
x = math.random(16, the.app.width-32),
29
y = math.random(16, the.app.height-32),
33
onUpdate = function(self, dt)
34
if the.player.moved then
35
-- this should encapsulate
36
for _, np in ipairs(the.clones.sprites) do
40
the.clones:collide(self.map)
41
the.player:collide(self.map)
44
the.clones:collide(the.player)
46
the.player.moved = false
49
if the.keys:justPressed('escape', 'q') then
57
onRun = function (self)
58
print('Version: ' .. VERSION)
60
self.view = GameView:new()
63
self.console:watch('VERSION', 'VERSION')
65
-- back off that dark overlay a bit
66
self.console.fill.fill[4] = 75
69
onUpdate = function (self, dt)
70
if the.keys:justPressed('f1') then
71
local ss = love.graphics.newScreenshot()
72
ss:encode('screenshot-' ..love.timer.getTime()..'.png')