/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-15 23:20:49 UTC
  • Revision ID: josh@9ix.org-20130615232049-foxrdwozglvama5w
close button

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
require 'bullet'
17
17
require 'rock'
18
18
require 'boom'
 
19
require 'planet'
 
20
require 'trade_view'
19
21
 
20
22
util = {
21
23
   signOf = function(value)
109
111
              self:add(the.planets)
110
112
 
111
113
              --the.player = CrystalPlayer:new{x=400,y=300}
112
 
              the.player = SpacePlayer:new{x=1366,y=768}
 
114
              the.player = SpacePlayer:new{x=the.bg.width / 2, y=the.bg.height / 2}
113
115
              self:add(the.player)
114
116
              self:add(the.player.thrust)
115
117
 
123
125
              self:add(the.interface)
124
126
 
125
127
              for _ = 1, math.random(6) do
126
 
                 local planet = Tile:new{
127
 
                    image = 'data/planet1.png',
 
128
                 local planet = Planet:new{
128
129
                    x = math.random(the.app.width / 2,
129
130
                                    the.bg.width - the.app.width / 2),
130
131
                    y = math.random(the.app.height / 2,
132
133
                    rotation = math.random() * math.pi
133
134
                 }
134
135
                 the.planets:add(planet)
135
 
 
136
 
                 planet.indicator = Tile:new{
137
 
                    image = 'data/planet1ind.png',
138
 
                 }
139
 
                 the.indicators:add(planet.indicator)
140
136
              end
141
137
 
142
138
              the.cursor = Cursor:new()
245
241
                       planet.indicator.visible = true
246
242
 
247
243
                       if math.abs(pvec.x) / math.abs(pvec.y) > the.app.width / the.app.height then
248
 
                          indx = the.app.width / 2 * util.signOf(pvec.x) + 8
249
 
                          indy = the.app.width / 2 * pvec.y / math.abs(pvec.x)
 
244
                          indx = (the.app.width / 2 - 10) * util.signOf(pvec.x) + 8
 
245
                          indy = (the.app.width / 2 - 10) * pvec.y / math.abs(pvec.x)
250
246
                       else
251
 
                          indy = the.app.height / 2 * util.signOf(pvec.y) + 8
252
 
                          indx = the.app.height / 2 * pvec.x / math.abs(pvec.y)
 
247
                          indy = (the.app.height / 2 - 10) * util.signOf(pvec.y) + 8
 
248
                          indx = (the.app.height / 2 - 10) * pvec.x / math.abs(pvec.y)
253
249
                       end
254
250
 
255
251
                       planet.indicator.x = the.player.x + indx
312
308
 
313
309
              self.view = GameView:new()
314
310
 
315
 
              -- should fail silently if it can't go to fullscreen...
316
 
              love.graphics.toggleFullscreen()
317
 
 
318
311
              if DEBUG then
319
312
                 self.console:watch('VERSION', 'VERSION')
320
313
                 self.console:watch('updateTook', 'the.updateTook')
357
350
               end
358
351
            end
359
352
}
 
353
 
 
354
realRun = love.run
 
355
function love.run()
 
356
   -- should fail silently if it can't go to fullscreen...
 
357
   love.graphics.toggleFullscreen()
 
358
 
 
359
   realRun()
 
360
end
 
 
b'\\ No newline at end of file'