/ld28

To get this branch, use:
bzr branch http://9ix.org/bzr/ld28

« back to all changes in this revision

Viewing changes to main.lua

  • Committer: Josh C
  • Date: 2013-12-15 20:03:17 UTC
  • Revision ID: josh@9ix.org-20131215200317-nr8no8pnv222eo39
R = restart level

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
                                })
44
44
              end
45
45
 
 
46
              if self.level == 3 then
 
47
                 self:add(Text:new{
 
48
                             text = "R = Restart level",
 
49
                             x = 20, y = 20,
 
50
                             width = 200
 
51
                          })
 
52
              end
 
53
 
46
54
              if self.level ~= 1 then
47
55
                 self:flash({0,0,0})
48
56
              end
80
88
                    the.player.moved = false
81
89
                 end
82
90
 
83
 
                 if the.keys:justPressed('escape', 'q') then
84
 
                    the.app:quit()
 
91
                 if the.keys:justPressed('r') then
 
92
                    the.app.view = GameView:new{level = self.level}
85
93
                 end
86
94
              end,
87
95
}
117
125
           end
118
126
}
119
127
 
 
128
TitleView = View:extend {
 
129
   onNew = function(self)
 
130
              self:add(Tile:new{
 
131
                          image = 'data/title.png'
 
132
                       })
 
133
           end,
 
134
   onUpdate = function(self)
 
135
                 if the.keys:allJustPressed() then
 
136
                    the.app.view = GameView:new{level = 1}
 
137
                 end
 
138
              end
 
139
}
 
140
 
120
141
the.app = App:new {
121
142
   name = "LD28",
122
143
   fps = 30,
123
144
   onRun = function (self)
124
145
              print('Version: ' .. VERSION)
125
146
 
126
 
              self.view = GameView:new{level = 1}
127
 
              --self.view = SlowView:new{level = 1}
 
147
              --self.view = GameView:new{level = 1}
 
148
              self.view = TitleView:new()
128
149
 
129
150
              if DEBUG then
130
151
                 self.console:watch('VERSION', 'VERSION')
139
160
                    local ss = love.graphics.newScreenshot()
140
161
                    ss:encode('screenshot-' ..love.timer.getTime()..'.png')
141
162
                 end
 
163
 
 
164
                 if the.keys:justPressed('escape', 'q') then
 
165
                    the.app:quit()
 
166
                 end
142
167
              end
143
168
}