/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:22:34 UTC
  • Revision ID: josh@9ix.org-20130428052234-4jjiqqj1qdgczx1w
don't pick things up twice

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'},
51
43
                   }
52
44
                end
53
45
   },
54
 
   -- village = {
55
 
   --    objects = function() return {
56
 
   --                    Tile:new{image = 'data/village-bg.png'},
57
 
   --                    Player:new{x = 121, y = 440,
58
 
   --                               image = 'data/village-player.png'},
59
 
   --                 }
60
 
   --              end
61
 
   -- },
62
 
   bridge = {
 
46
   village = {
63
47
      objects = function() return {
64
 
                      Tile:new{image = 'data/bridge-bg.png'},
 
48
                      Tile:new{image = 'data/village-bg.png'},
65
49
                      Player:new{x = 121, y = 440,
66
 
                                 image = 'data/bridge-player.png'},
67
 
                      Tile:new{image = 'data/bridge-fg.png'}
 
50
                                 image = 'data/village-player.png'},
68
51
                   }
69
52
                end
70
53
   }
71
54
}
72
55
 
73
56
GameView = View:extend {
74
 
   level = 'shore', --default level
 
57
   level = 'forest1', --default level
75
58
   onNew = function (self)
76
59
              --print('loading level: '..self.level)
77
 
              if not levels[self.level] then
78
 
                 error('no such level: '..self.level)
79
 
              end
80
60
              for _, obj in ipairs(levels[self.level].objects()) do
81
61
                 self:add(obj)
82
62
              end
99
79
             love.graphics.print('version:' .. VERSION, 20, 570)
100
80
          end,
101
81
   onUpdate = function (self, dt)
 
82
                 if the.keys:justPressed('a') then
 
83
                    the.app.view = GameView:new{level = 'forest1'}
 
84
                 elseif the.keys:justPressed('b') then
 
85
                    the.app.view = GameView:new{level = 'shore'}
 
86
                 end
102
87
              end
103
88
}
104
89