/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-28 05:19:04 UTC
  • Revision ID: josh@9ix.org-20130428051904-7j0sucv9tm8rqdkf
inventory (and a flower)

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
                      Tile:new{image = 'data/forest1-fg.png'}
25
25
                   } end,
26
26
   },
27
 
   foresthut = {
28
 
      objects = function() return {
29
 
                      Tile:new{image = 'data/foresthut-bg.png'},
30
 
                      Player:new{x = 745, y = 430,
31
 
                                 image = 'data/forest1-player.png'},
32
 
                      Tile:new{image = 'data/foresthut-fg.png'}
33
 
                   } end,
34
 
   },
35
27
   shore = {
36
28
      objects = function() return {
37
29
                      Tile:new{image = 'data/shore-bg.png'},
62
54
}
63
55
 
64
56
GameView = View:extend {
65
 
   level = 'shore', --default level
 
57
   level = 'forest1', --default level
66
58
   onNew = function (self)
67
59
              --print('loading level: '..self.level)
68
60
              for _, obj in ipairs(levels[self.level].objects()) do
69
61
                 self:add(obj)
70
62
              end
71
63
              for _, obj in ipairs(svg_objects[self.level]) do
72
 
                 if not the.inventory.items[obj.name] then
73
 
                    self:add(obj)
74
 
                 end
 
64
                 self:add(obj)
75
65
              end
76
66
 
77
67
              self:add(the.inventory)
87
77
             love.graphics.print('version:' .. VERSION, 20, 570)
88
78
          end,
89
79
   onUpdate = function (self, dt)
 
80
                 if the.keys:justPressed('a') then
 
81
                    the.app.view = GameView:new{level = 'forest1'}
 
82
                 elseif the.keys:justPressed('b') then
 
83
                    the.app.view = GameView:new{level = 'shore'}
 
84
                 end
90
85
              end
91
86
}
92
87