/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 16:51:36 UTC
  • Revision ID: josh@9ix.org-20130428165136-f3eg4lscd1mdb9wo
level tweaks

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
require 'player'
10
10
require 'transition'
11
11
require 'displacer'
 
12
require 'inventory'
 
13
require 'flower'
 
14
 
12
15
require 'svg_levels'
13
16
 
14
17
levels = {
31
34
                      Transition:new{x = 10, y = 133, target = 'forest1',
32
35
                                     targetX = 735, targetY = 370}
33
36
                   } end
 
37
   },
 
38
   lake = {
 
39
      objects = function() return {
 
40
                      Tile:new{image = 'data/lake-bg.png'},
 
41
                      Player:new{x = 540, y = 266,
 
42
                                 image = 'data/lake-player.png'},
 
43
                   }
 
44
                end
 
45
   },
 
46
   village = {
 
47
      objects = function() return {
 
48
                      Tile:new{image = 'data/village-bg.png'},
 
49
                      Player:new{x = 121, y = 440,
 
50
                                 image = 'data/village-player.png'},
 
51
                   }
 
52
                end
34
53
   }
35
54
}
36
55
 
37
56
GameView = View:extend {
38
 
   level = 'forest1', --default level
 
57
   level = 'shore', --default level
39
58
   onNew = function (self)
40
59
              --print('loading level: '..self.level)
41
60
              for _, obj in ipairs(levels[self.level].objects()) do
42
61
                 self:add(obj)
43
62
              end
44
63
              for _, obj in ipairs(svg_objects[self.level]) do
45
 
                 self:add(obj)
 
64
                 if not the.inventory.items[obj.name] then
 
65
                    self:add(obj)
 
66
                 end
46
67
              end
47
68
 
 
69
              self:add(the.inventory)
 
70
 
48
71
              self:flash({0,0,0})
49
72
 
50
73
              --self.focus = the.player
52
75
           end,
53
76
   draw = function (self, x, y)
54
77
             View.draw(self, x, y)
55
 
             love.graphics.print('FPS:' .. love.timer.getFPS(), 20, 20)
 
78
             --love.graphics.print('FPS:' .. love.timer.getFPS(), 20, 20)
56
79
             love.graphics.print('version:' .. VERSION, 20, 570)
57
80
          end,
58
81
   onUpdate = function (self, dt)
91
114
               end
92
115
            end
93
116
}
 
117
 
 
118
-- for accessing from debug console
 
119
function l(level)
 
120
   the.app.view = GameView:new{level = level}
 
121
end
 
 
b'\\ No newline at end of file'