/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 21:47:47 UTC
  • Revision ID: josh@9ix.org-20130625214747-bqjfaktdqj76aq8o
game over timer & penalty

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),
75
72
                                    x = planet.x,
76
73
                                    y = planet.y,
77
74
                                    rotation = planet.rotation,
78
 
                                    goods = planet.goods,
79
 
                                    name = planet.name
 
75
                                    goods = planet.goods
80
76
                                 })
81
77
                 end
82
78
 
83
 
                 Good:stockPlanets()
84
 
 
85
79
                 -- build fresh player
86
80
                 local player = SpacePlayer:new{x=the.bg.width / 2, y=the.bg.height / 2}
87
81
                 the.player = player
107
101
              end
108
102
 
109
103
              self:add(the.planets)
110
 
              self:add(the.planetLabels)
111
104
 
112
105
              self:add(the.player)
113
106
              self:add(the.player.thrust)
171
164
}
172
165
 
173
166
the.app = App:new {
174
 
   name = 'Traderous',
175
167
   onRun = function (self)
176
168
              print('Version: ' .. VERSION)
177
169
 
190
182
                 self.console:watch('num rocks', '#the.rocks.sprites')
191
183
                 self.console:watch('num planets', '#the.planets.sprites')
192
184
                 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
185
                 --self.console:watch('drawTook', 'the.drawTook')
196
186
 
197
187
                 -- back off that dark overlay a bit