/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-26 00:45:08 UTC
  • Revision ID: josh@9ix.org-20130626004508-6in13i6vjpu77els
give planets names

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
require 'shield'
22
22
require 'pause_view'
23
23
require 'game_over'
24
 
require 'names'
25
 
require 'good'
26
24
 
27
25
util = {
28
26
   signOf = function(value)
46
44
              the.bullets = Group:new()
47
45
              the.interface = Group:new()
48
46
              the.planets = Group:new()
49
 
              the.planetLabels = Group:new()
50
47
              the.indicators = Group:new()
51
48
              the.enemies = Group:new()
52
49
 
62
59
                 the.storage.data = {planets = {}}
63
60
 
64
61
                 -- build planets from random
65
 
                 for _ = 1, math.random(5, 7) do
 
62
                 for _ = 1, math.random(3, 6) do
66
63
                    local planet = Planet:new{
67
64
                       x = math.random(the.app.width / 2,
68
65
                                       the.bg.width - the.app.width / 2),
80
77
                                 })
81
78
                 end
82
79
 
83
 
                 Good:stockPlanets()
84
 
 
85
80
                 -- build fresh player
86
81
                 local player = SpacePlayer:new{x=the.bg.width / 2, y=the.bg.height / 2}
87
82
                 the.player = player
107
102
              end
108
103
 
109
104
              self:add(the.planets)
110
 
              self:add(the.planetLabels)
111
105
 
112
106
              self:add(the.player)
113
107
              self:add(the.player.thrust)
171
165
}
172
166
 
173
167
the.app = App:new {
174
 
   name = 'Traderous',
175
168
   onRun = function (self)
176
169
              print('Version: ' .. VERSION)
177
170
 
190
183
                 self.console:watch('num rocks', '#the.rocks.sprites')
191
184
                 self.console:watch('num planets', '#the.planets.sprites')
192
185
                 self.console:watch('num enemies', 'the.enemies:count()')
193
 
                 self.console:watch('onPlanet', 'the.player.onPlanet')
194
 
                 self.console:watch('kills', 'the.player.kills')
195
186
                 --self.console:watch('drawTook', 'the.drawTook')
196
187
 
197
188
                 -- back off that dark overlay a bit