12
GameView = View:extend {
14
onNew = function (self)
15
self:loadLayers('data/map.lua')
16
self.focus = the.player
19
self.mazes = {self.maze1, self.maze2}
22
the.activeMaze = self.maze1
24
--the.interface = Group:new()
26
--self:add(the.interface)
28
self.gameStart = love.timer.getMicroTime()
29
self.lastChange = love.timer.getMicroTime()
31
onUpdate = function(self, dt)
32
if the.player.active and love.timer.getMicroTime() > self.lastChange + 10 then
35
if the.activeMaze == self.maze1 then
36
the.activeMaze = self.maze2
38
the.activeMaze = self.maze1
40
the.activeMaze:revive()
42
self.lastChange = love.timer.getMicroTime()
45
the.activeMaze:collide(the.player)
48
-- for _, mirror in ipairs(the.mirrors.sprites) do
49
-- if not mirror.of then
50
-- print('mirror:' .. inspect(mirror))
51
-- error('mirror OF NOTHING')
55
onEndFrame = function(self)
56
--the.interface.translate.x = the.player.x - the.app.width / 2 + the.player.width / 2
57
--the.interface.translate.y = the.player.y - the.app.height / 2 + the.player.height / 2
61
MenuScreen = View:extend {
62
title = Text:new{text = "Press a key to start", font = 48, wordWrap = false},
63
--title = Tile:new{image = 'data/title.png', x = 0, y = 0},
64
onNew = function(self)
66
self.title:centerAround(400, 200)
68
onUpdate = function(self, elapsed)
69
if the.keys:allJustPressed() then
70
the.app.view = GameView:new()
76
onRun = function (self)
77
print('Version: ' .. VERSION)
79
self.view = GameView:new()
82
self.console:watch('VERSION', 'VERSION')
84
-- back off that dark overlay a bit
85
self.console.fill.fill[4] = 75
88
onUpdate = function (self, dt)
89
if the.keys:justPressed('escape') then