11
GameView = View:extend {
12
onNew = function (self)
13
self:newLevel('forest1')
15
--self:loadLayers('data/map.lua')
16
--self.focus = the.player
17
--self:clampTo(self.map)
19
draw = function (self, x, y)
21
love.graphics.print('FPS:' .. love.timer.getFPS(), 20, 20)
22
love.graphics.print('version:' .. VERSION, 20, 570)
24
onUpdate = function (self, dt)
25
if the.keys:justPressed('a') then
26
self:newLevel('forest1')
27
elseif the.keys:justPressed('b') then
28
self:newLevel('shore')
31
newLevel = function (self, level)
33
bg = Tile:new{image = 'data/' .. level .. '-bg.png'}
34
fg = Tile:new{image = 'data/' .. level .. '-fg.png'}
35
the.player = Player:new{x = 196, y = 350}
43
onRun = function (self)
44
self.view = GameView:new()
46
self.console:watch('VERSION', 'VERSION')
47
self.console:watch('updateTook', 'the.updateTook')
48
--self.console:watch('drawTook', 'the.drawTook')
51
onUpdate = function (self, dt)
52
if the.keys:justPressed('escape') then
56
update = function (self, dt)
57
the.updateStart = love.timer.getMicroTime()
59
if the.updateStart then
60
the.updateTook = love.timer.getMicroTime() - the.updateStart