/ld26

To get this branch, use:
bzr branch /bzr/ld26
5 by Josh C
load a level, move a player around
1
STRICT = true
2
DEBUG = true
3
4
require 'zoetrope'
5
6
--require 'sprite'
7
require 'version'
8
9
require 'player'
10
11
GameView = View:extend {
12
   onNew = function (self)
13
              bg = Tile:new{image = 'data/forest1-bg.png'}
14
              fg = Tile:new{image = 'data/forest1-fg.png'}
15
              the.player = Player:new{x = 196, y = 350}
16
              self:add(bg)
17
              self:add(the.player)
18
              self:add(fg)
19
20
              --self:loadLayers('data/map.lua')
21
              --self.focus = the.player
22
              --self:clampTo(self.map)
23
           end,
24
   draw = function (self, x, y)
25
             View.draw(self, x, y)
26
             love.graphics.print('FPS:' .. love.timer.getFPS(), 20, 20)
27
          end
28
}
29
30
the.app = App:new {
31
   onRun = function (self)
32
              self.view = GameView:new()
33
              if DEBUG then
34
                 self.console:watch('VERSION', 'VERSION')
35
                 self.console:watch('updateTook', 'the.updateTook')
36
                 --self.console:watch('drawTook', 'the.drawTook')
37
              end
38
           end,
39
   onUpdate = function (self, dt)
40
                 if the.keys:justPressed('escape') then
41
                    self.quit()
42
                 end
43
              end,
44
   update = function (self, dt)
45
               the.updateStart = love.timer.getMicroTime()
46
               App.update(self, dt)
47
               if the.updateStart then
48
                  the.updateTook = love.timer.getMicroTime() - the.updateStart
49
               end
50
            end
51
}