/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 01:21:46 UTC
  • Revision ID: josh@9ix.org-20130428012146-42c1hx6r1g7y1kgu
fadeĀ in

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