13
GameView = View:extend {
15
onNew = function (self)
16
self:loadLayers('data/map.lua')
17
self.focus = the.player
20
self.mazes = {self.maze1, self.maze2}
23
the.activeMaze = self.maze1
25
--the.interface = Group:new()
27
--self:add(the.interface)
31
self.gameStart = love.timer.getMicroTime()
32
self.lastChange = love.timer.getMicroTime()
34
onUpdate = function(self, dt)
35
if the.player.active and love.timer.getMicroTime() > self.lastChange + 10 then
40
the.activeMaze:collide(the.player)
43
-- for _, mirror in ipairs(the.mirrors.sprites) do
44
-- if not mirror.of then
45
-- print('mirror:' .. inspect(mirror))
46
-- error('mirror OF NOTHING')
50
switchMaze = function(self)
52
if the.activeMaze == self.maze1 then
53
the.activeMaze = self.maze2
55
the.activeMaze = self.maze1
57
the.activeMaze:revive()
60
self.tween:start(self._fx, 4, 150, 10, 'quadIn')
62
self.lastChange = love.timer.getMicroTime()
64
onEndFrame = function(self)
65
--the.interface.translate.x = the.player.x - the.app.width / 2 + the.player.width / 2
66
--the.interface.translate.y = the.player.y - the.app.height / 2 + the.player.height / 2
70
MenuScreen = View:extend {
71
title = Text:new{text = "Press a key to start", font = 48, wordWrap = false},
72
--title = Tile:new{image = 'data/title.png', x = 0, y = 0},
73
onNew = function(self)
75
self.title:centerAround(400, 200)
77
onUpdate = function(self, elapsed)
78
if the.keys:allJustPressed() then
79
the.app.view = GameView:new()
85
onRun = function (self)
86
print('Version: ' .. VERSION)
88
self.view = GameView:new()
91
self.console:watch('VERSION', 'VERSION')
93
-- back off that dark overlay a bit
94
self.console.fill.fill[4] = 75
97
onUpdate = function (self, dt)
98
if the.keys:justPressed('escape') then