/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-10 23:42:44 UTC
  • Revision ID: josh@9ix.org-20130610234244-r0qlqjqjymdc5nhs
move fullscreen into love.run so it doesn't keep toggling on ctl-alt-R

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'
21
19
 
22
20
util = {
23
21
   signOf = function(value)
111
109
              self:add(the.planets)
112
110
 
113
111
              --the.player = CrystalPlayer:new{x=400,y=300}
114
 
              the.player = SpacePlayer:new{x=the.bg.width / 2, y=the.bg.height / 2}
 
112
              the.player = SpacePlayer:new{x=1366,y=768}
115
113
              self:add(the.player)
116
114
              self:add(the.player.thrust)
117
115
 
125
123
              self:add(the.interface)
126
124
 
127
125
              for _ = 1, math.random(6) do
128
 
                 local planet = Planet:new{
 
126
                 local planet = Tile:new{
 
127
                    image = 'data/planet1.png',
129
128
                    x = math.random(the.app.width / 2,
130
129
                                    the.bg.width - the.app.width / 2),
131
130
                    y = math.random(the.app.height / 2,
133
132
                    rotation = math.random() * math.pi
134
133
                 }
135
134
                 the.planets:add(planet)
 
135
 
 
136
                 planet.indicator = Tile:new{
 
137
                    image = 'data/planet1ind.png',
 
138
                 }
 
139
                 the.indicators:add(planet.indicator)
136
140
              end
137
141
 
138
142
              the.cursor = Cursor:new()
241
245
                       planet.indicator.visible = true
242
246
 
243
247
                       if math.abs(pvec.x) / math.abs(pvec.y) > the.app.width / the.app.height then
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)
 
248
                          indx = the.app.width / 2 * util.signOf(pvec.x) + 8
 
249
                          indy = the.app.width / 2 * pvec.y / math.abs(pvec.x)
246
250
                       else
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)
 
251
                          indy = the.app.height / 2 * util.signOf(pvec.y) + 8
 
252
                          indx = the.app.height / 2 * pvec.x / math.abs(pvec.y)
249
253
                       end
250
254
 
251
255
                       planet.indicator.x = the.player.x + indx