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)
30
self.gameStart = love.timer.getMicroTime()
31
self.lastChange = love.timer.getMicroTime()
33
onUpdate = function(self, dt)
34
if the.player.active and love.timer.getMicroTime() > self.lastChange + 10 then
39
the.activeMaze:collide(the.player)
42
-- for _, mirror in ipairs(the.mirrors.sprites) do
43
-- if not mirror.of then
44
-- print('mirror:' .. inspect(mirror))
45
-- error('mirror OF NOTHING')
49
switchMaze = function(self)
51
if the.activeMaze == self.maze1 then
52
the.activeMaze = self.maze2
54
the.activeMaze = self.maze1
56
the.activeMaze:revive()
59
self.tween:start(self._fx, 4, 150, 10, 'quadIn')
61
self.lastChange = love.timer.getMicroTime()
63
onEndFrame = function(self)
64
--the.interface.translate.x = the.player.x - the.app.width / 2 + the.player.width / 2
65
--the.interface.translate.y = the.player.y - the.app.height / 2 + the.player.height / 2
69
MenuScreen = View:extend {
70
title = Text:new{text = "Press a key to start", font = 48, wordWrap = false},
71
--title = Tile:new{image = 'data/title.png', x = 0, y = 0},
72
onNew = function(self)
74
self.title:centerAround(400, 200)
76
onUpdate = function(self, elapsed)
77
if the.keys:allJustPressed() then
78
the.app.view = GameView:new()
84
onRun = function (self)
85
print('Version: ' .. VERSION)
87
self.view = GameView:new()
90
self.console:watch('VERSION', 'VERSION')
92
-- back off that dark overlay a bit
93
self.console.fill.fill[4] = 75
96
onUpdate = function (self, dt)
97
if the.keys:justPressed('escape') then