/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-25 17:14:14 UTC
  • Revision ID: josh@9ix.org-20130625171414-khfaax8xfufz0mml
respawn enemies

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