/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-06-23 02:06:35 UTC
  • Revision ID: josh@9ix.org-20130623020635-31ov2mbrb67xe0h0
more mirror cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
require 'planet'
20
20
require 'trade_view'
21
21
require 'shield'
22
 
require 'pause_view'
23
22
 
24
23
util = {
25
24
   signOf = function(value)
48
47
 
49
48
              the.bg = Tile:new{
50
49
                 image = 'data/stars3.png',
51
 
                 width = 27320,
52
 
                 height = 15360
 
50
                 width = 13660,
 
51
                 height = 7680
53
52
              }
54
53
              self:add(the.bg)
55
54
 
63
62
 
64
63
              self:add(the.enemies)
65
64
 
66
 
              for _ = 1, 20 do
 
65
              for _ = 1, 5 do
67
66
                 local e = Enemy:new{x = math.random(the.bg.width),
68
67
                                     y = math.random(the.bg.height)}
69
68
                 --local e = Enemy:new{x=the.bg.width / 2, y=the.bg.height / 2}
118
117
              self.focus = the.player
119
118
           end,
120
119
   onUpdate = function(self, dt)
121
 
                 if the.keys:justPressed('escape') then
122
 
                    PauseView:new():activate()
123
 
                 end
124
 
 
125
120
                 the.bullets:collide(the.planets)
126
121
                 the.bullets:collide(the.player)
127
122
                 the.bullets:collide(the.enemies)
168
163
                 self.console:watch('num mirrors', '#the.mirrors.sprites')
169
164
                 self.console:watch('num rocks', '#the.rocks.sprites')
170
165
                 self.console:watch('num planets', '#the.planets.sprites')
171
 
                 self.console:watch('num enemies', 'the.enemies:count()')
172
166
                 --self.console:watch('drawTook', 'the.drawTook')
173
167
 
174
168
                 -- back off that dark overlay a bit
177
171
           end,
178
172
   onUpdate = function (self, dt)
179
173
                 if not (DEBUG and the.console.visible) then
180
 
                    if the.keys:justPressed('return') and the.keys:pressed('alt') then
181
 
                       love.graphics.toggleFullscreen()
 
174
                    if the.keys:justPressed('q') then
 
175
                       self.quit()
 
176
                    elseif the.keys:justPressed('return') then
 
177
                       if the.keys:pressed('alt') then
 
178
                          love.graphics.toggleFullscreen()
 
179
                       else
 
180
                          self.view = GameView:new()
 
181
                       end
182
182
                    elseif the.keys:justPressed('f1') then
183
183
                       local ss = love.graphics.newScreenshot()
184
184
                       ss:encode('screenshot-' ..love.timer.getTime()..'.png')