/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-10-21 18:31:55 UTC
  • Revision ID: josh@9ix.org-20131021183155-vl7pxaor2u3pw0t0
have enemies disengage when you land

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