/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 18:52:04 UTC
  • Revision ID: josh@9ix.org-20130428185204-auxrflmqghvti2zm
put levels in their own file

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
DEBUG = true
3
3
 
4
4
require 'zoetrope'
5
 
--inspect = require 'inspect'
6
5
 
7
6
--require 'sprite'
8
7
require 'version'
11
10
require 'transition'
12
11
require 'displacer'
13
12
require 'inventory'
 
13
require 'flower'
14
14
require 'levels'
15
 
require 'items'
16
 
require 'troll'
17
 
require 'gatetrigger'
18
15
 
19
16
require 'svg_levels'
20
17
 
21
18
GameView = View:extend {
 
19
   level = 'shore', --default level
22
20
   onNew = function (self)
23
21
              --print('loading level: '..self.level)
24
22
              if not levels[self.level] then
26
24
              end
27
25
              for _, obj in ipairs(levels[self.level].objects()) do
28
26
                 self:add(obj)
29
 
                 --if obj.gateup then print('ADDING GATEUP') end
30
27
              end
31
28
              for _, obj in ipairs(svg_objects[self.level]) do
32
29
                 if not the.inventory.items[obj.name] then
34
31
                 end
35
32
              end
36
33
 
37
 
              --self:add(Fill:new{x=100,y=100,width=25,height=25,fill={255,255,255}})
38
 
 
39
34
              self:add(the.inventory)
40
35
 
41
36
              self:flash({0,0,0})
46
41
   draw = function (self, x, y)
47
42
             View.draw(self, x, y)
48
43
             --love.graphics.print('FPS:' .. love.timer.getFPS(), 20, 20)
49
 
             --love.graphics.print('version:' .. VERSION, 20, 570)
 
44
             love.graphics.print('version:' .. VERSION, 20, 570)
50
45
          end,
51
46
   onUpdate = function (self, dt)
52
47
              end
53
48
}
54
49
 
55
50
the.app = App:new {
56
 
   level = 'shore', --default level
57
51
   onRun = function (self)
58
 
              print('Version: ' .. VERSION)
59
 
              self.view = GameView:new{level = self.level}
 
52
              self.view = GameView:new()
60
53
              if DEBUG then
61
54
                 self.console:watch('VERSION', 'VERSION')
62
55
                 self.console:watch('updateTook', 'the.updateTook')
67
60
                 -- back off that dark overlay a bit
68
61
                 self.console.fill.fill[4] = 75
69
62
              end
70
 
 
71
 
              --the.inventory:add(Flag:new())
72
63
           end,
73
64
   onUpdate = function (self, dt)
74
65
                 if the.keys:justPressed('escape') then
87
78
-- for accessing from debug console
88
79
function l(level)
89
80
   the.app.view = GameView:new{level = level}
90
 
end
91
 
 
92
 
function love.load(arg)
93
 
   if arg[2] then
94
 
      the.app.level = arg[2]
95
 
   end
96
 
 
97
 
   the.app:run()
98
81
end
 
 
b'\\ No newline at end of file'