/traderous

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

« back to all changes in this revision

Viewing changes to main.lua

  • Committer: Josh C
  • Date: 2013-05-20 17:54:50 UTC
  • Revision ID: josh@9ix.org-20130520175450-1p2jpuadg24xutlk
some instructions at game over

Show diffs side-by-side

added added

removed removed

Lines of Context:
91
91
                 the.storage.data = {highScore = 0}
92
92
              end
93
93
 
94
 
              --the.rockColliders = Group:new()
 
94
              the.rockColliders = Group:new()
95
95
              the.bullets = Group:new()
96
96
              the.mirrors = Group:new()
97
 
              --the.rocks = Group:new()
 
97
              the.rocks = Group:new()
98
98
              the.interface = Group:new()
99
 
              the.planets = Group:new()
100
99
 
101
100
              the.bg = Tile:new{
102
101
                 image = 'data/stars3.png',
106
105
              }
107
106
              self:add(the.bg)
108
107
 
109
 
              self:add(the.planets)
110
 
 
111
108
              --the.player = CrystalPlayer:new{x=400,y=300}
112
109
              the.player = SpacePlayer:new{x=1366,y=768}
113
110
              self:add(the.player)
114
 
              self:add(the.player.thrust)
115
111
 
116
112
              --self:add(Enemy:new{x=400, y=300})
117
113
 
118
114
              self:add(the.bullets)
119
 
              --self:add(the.rockColliders)
 
115
              self:add(the.rockColliders)
120
116
              self:add(the.mirrors)
121
 
              --self:add(the.rocks)
 
117
              self:add(the.rocks)
122
118
              self:add(the.interface)
123
119
 
124
 
              local planet = Tile:new{
125
 
                 image = 'data/planet1.png',
126
 
                 x = math.random(the.app.width / 2,
127
 
                                 the.bg.width - the.app.width / 2),
128
 
                 y = math.random(the.app.height / 2,
129
 
                                 the.bg.height - the.app.height / 2),
130
 
              }
131
 
              the.planets:add(planet)
132
 
 
133
120
              the.cursor = Cursor:new()
134
121
              self:add(the.cursor)
135
122
 
187
174
              self.gameStart = love.timer.getTime()
188
175
           end,
189
176
   onUpdate = function(self, dt)
190
 
                 if false and the.player.active and love.timer.getTime() > self.lastRock + self.rockInterval then
 
177
                 if the.player.active and love.timer.getTime() > self.lastRock + self.rockInterval then
191
178
                    local unseenRock = nil
192
179
                    while not unseenRock do
193
180
                       local rock = Rock:new{
271
258
              math.randomseed(os.time())
272
259
 
273
260
              self.view = GameView:new()
274
 
 
275
 
              -- should fail silently if it can't go to fullscreen...
276
 
              love.graphics.toggleFullscreen()
277
 
 
278
261
              if DEBUG then
279
262
                 self.console:watch('VERSION', 'VERSION')
280
263
                 self.console:watch('updateTook', 'the.updateTook')
291
274
              end
292
275
           end,
293
276
   onUpdate = function (self, dt)
294
 
                 if the.keys:justPressed('q') then
 
277
                 if the.keys:justPressed('escape') then
295
278
                    self.quit()
296
 
                 elseif the.keys:justPressed('return') then
297
 
                    if the.keys:pressed('alt') then
298
 
                       love.graphics.toggleFullscreen()
299
 
                    else
300
 
                       self.view = GameView:new()
301
 
                    end
302
 
                 elseif the.keys:justPressed('f1') then
303
 
                    local ss = love.graphics.newScreenshot()
304
 
                    ss:encode('screenshot-' ..love.timer.getTime()..'.png')
305
 
                 elseif the.keys:justPressed('f11') then
306
 
                    love.graphics.toggleFullscreen()
307
279
                 end
308
280
              end,
309
281
   update = function (self, dt)