/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-29 01:26:02 UTC
  • Revision ID: josh@9ix.org-20130429012602-ev6ww21nb01zgddg
out of bounds

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