/ld26

To get this branch, use:
bzr branch /bzr/ld26

« back to all changes in this revision

Viewing changes to main.lua

  • Committer: Josh C
  • Date: 2013-04-28 01:21:46 UTC
  • Revision ID: josh@9ix.org-20130428012146-42c1hx6r1g7y1kgu
fade in

Show diffs side-by-side

added added

removed removed

35
35
}
36
36
 
37
37
GameView = View:extend {
 
38
   level = 'forest1', --default level
38
39
   onNew = function (self)
39
 
              self:newLevel('forest1')
40
 
 
41
 
              --self:loadLayers('data/map.lua')
 
40
              --print('loading level: '..self.level)
 
41
              for _, obj in ipairs(levels[self.level].objects()) do
 
42
                 self:add(obj)
 
43
              end
 
44
              for _, obj in ipairs(svg_objects[self.level]) do
 
45
                 self:add(obj)
 
46
              end
 
47
 
 
48
              self:flash({0,0,0})
 
49
 
42
50
              --self.focus = the.player
43
51
              --self:clampTo(self.map)
44
52
           end,
49
57
          end,
50
58
   onUpdate = function (self, dt)
51
59
                 if the.keys:justPressed('a') then
52
 
                    self:newLevel('forest1')
 
60
                    the.app.view = GameView:new{level = 'forest1'}
53
61
                 elseif the.keys:justPressed('b') then
54
 
                    self:newLevel('shore')
55
 
                 end
56
 
              end,
57
 
   newLevel = function (self, level)
58
 
                 self.sprites = levels[level].objects()
59
 
                 for _, obj in ipairs(svg_objects[level]) do
60
 
                    self:add(obj)
 
62
                    the.app.view = GameView:new{level = 'shore'}
61
63
                 end
62
64
              end
63
65
}
68
70
              if DEBUG then
69
71
                 self.console:watch('VERSION', 'VERSION')
70
72
                 self.console:watch('updateTook', 'the.updateTook')
 
73
                 self.console:watch('view.tween.status', 'the.app.view.tween.status()')
 
74
                 self.console:watch('view.tween.active', 'the.app.view.tween.active')
71
75
                 --self.console:watch('drawTook', 'the.drawTook')
72
76
 
73
77
                 -- back off that dark overlay a bit