/spacey

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

« back to all changes in this revision

Viewing changes to main.lua

  • Committer: Josh C
  • Date: 2013-05-20 16:58:11 UTC
  • Revision ID: josh@9ix.org-20130520165811-wt18btbst2h0ftr6
remove fps counter

Show diffs side-by-side

added added

removed removed

Lines of Context:
95
95
              the.bullets = Group:new()
96
96
              the.mirrors = Group:new()
97
97
              the.rocks = Group:new()
98
 
              the.interface = Group:new()
99
98
 
100
99
              the.bg = Tile:new{
101
100
                 image = 'data/stars3.png',
115
114
              self:add(the.rockColliders)
116
115
              self:add(the.mirrors)
117
116
              self:add(the.rocks)
118
 
              self:add(the.interface)
119
117
 
120
118
              the.cursor = Cursor:new()
121
119
              self:add(the.cursor)
122
120
 
123
121
              the.score = Text:new{
124
 
                 x = 8,
125
 
                 y = 8,
126
122
                 width = the.app.width,
127
123
                 --align = 'center',
128
124
                 font = 25}
129
 
              the.interface:add(the.score)
 
125
              self:add(the.score)
130
126
 
131
127
              local hs = the.storage.data.highScore
132
128
              local m = hs / 60
133
129
              local s = hs % 60
134
130
 
135
131
              the.highScore = Text:new{
136
 
                 x = -8,
137
 
                 y = 8,
138
132
                 width = the.app.width,
139
133
                 align = 'right',
140
134
                 font = 25,
141
135
                 text = string.format('High Score: %d:%02d', m, s)
142
136
              }
143
 
              the.interface:add(the.highScore)
144
 
 
145
 
              the.over = Text:new{
146
 
                 y = the.app.height / 2,
147
 
                 width = the.app.width,
148
 
                 align = 'center',
149
 
                 font = 25,
150
 
                 text = "Game Over",
151
 
                 visible = false
152
 
              }
153
 
              the.interface:add(the.over)
154
 
 
155
 
 
156
 
              the.instructions = Text:new{
157
 
                 y = the.app.height / 2 + 32,
158
 
                 width = the.app.width,
159
 
                 align = 'center',
160
 
                 font = 12,
161
 
                 text = "Press Enter to start a new game\nPress Q to quit",
162
 
                 visible = false
163
 
              }
164
 
              the.interface:add(the.instructions)
 
137
              self:add(the.highScore)
165
138
 
166
139
              love.mouse.setGrab(true)
167
140
              love.mouse.setVisible(false)
212
185
                 -- end
213
186
              end,
214
187
   onEndFrame = function(self)
215
 
                   the.interface.translate.x = the.player.x - the.app.width / 2 + the.player.width / 2
216
 
                   the.interface.translate.y = the.player.y - the.app.height / 2 + the.player.height / 2
217
 
 
218
188
                   if the.player.active then
219
189
                      self:updateScore()
220
190
                   end
229
199
                    local s = t % 60
230
200
 
231
201
                    the.score.text = string.format('Score: %d:%02d', m, s)
232
 
                    --the.score.y = the.player.y - the.app.height / 2 + the.player.height
233
 
                    --the.score.x = the.player.x - the.app.width / 2 + the.player.width
 
202
                    the.score.y = the.player.y - the.app.height / 2 + the.player.height
 
203
                    the.score.x = the.player.x - the.app.width / 2 + the.player.width
234
204
 
235
 
                    --the.highScore.y = the.player.y - the.app.height / 2 + the.player.height
236
 
                    --the.highScore.x = the.player.x - the.app.width / 2
 
205
                    the.highScore.y = the.player.y - the.app.height / 2 + the.player.height
 
206
                    the.highScore.x = the.player.x - the.app.width / 2
237
207
                 end
238
208
}
239
209
 
274
244
              end
275
245
           end,
276
246
   onUpdate = function (self, dt)
277
 
                 if the.keys:justPressed('q') then
 
247
                 if the.keys:justPressed('escape') then
278
248
                    self.quit()
279
 
                 elseif the.keys:justPressed('return') then
280
 
                    self.view = GameView:new()
281
249
                 end
282
250
              end,
283
251
   update = function (self, dt)