/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:51 UTC
  • Revision ID: josh@9ix.org-20130428185251-a9cpmdjiooz89gu5
s/basecode/ld26/

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