/ld26

To get this branch, use:
bzr branch http://9ix.org/bzr/ld26

« back to all changes in this revision

Viewing changes to main.lua

  • Committer: Josh C
  • Date: 2013-04-27 23:43:03 UTC
  • Revision ID: josh@9ix.org-20130427234303-35drcx68t13gb3b8
more transitions and collisions

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
}
36
36
 
37
37
GameView = View:extend {
38
 
   level = 'forest1', --default level
39
38
   onNew = function (self)
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
 
 
 
39
              self:newLevel('forest1')
 
40
 
 
41
              --self:loadLayers('data/map.lua')
50
42
              --self.focus = the.player
51
43
              --self:clampTo(self.map)
52
44
           end,
57
49
          end,
58
50
   onUpdate = function (self, dt)
59
51
                 if the.keys:justPressed('a') then
60
 
                    the.app.view = GameView:new{level = 'forest1'}
 
52
                    self:newLevel('forest1')
61
53
                 elseif the.keys:justPressed('b') then
62
 
                    the.app.view = GameView:new{level = 'shore'}
 
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)
63
61
                 end
64
62
              end
65
63
}
70
68
              if DEBUG then
71
69
                 self.console:watch('VERSION', 'VERSION')
72
70
                 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')
75
71
                 --self.console:watch('drawTook', 'the.drawTook')
76
72
 
77
73
                 -- back off that dark overlay a bit