/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 18:23:38 UTC
  • Revision ID: josh@9ix.org-20130625182338-gkx8evr4z93zh9x7
load/save (not working yet)

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
require 'trade_view'
21
21
require 'shield'
22
22
require 'pause_view'
23
 
require 'game_over'
24
 
require 'names'
25
23
 
26
24
util = {
27
25
   signOf = function(value)
45
43
              the.bullets = Group:new()
46
44
              the.interface = Group:new()
47
45
              the.planets = Group:new()
48
 
              the.planetLabels = Group:new()
49
46
              the.indicators = Group:new()
50
47
              the.enemies = Group:new()
51
48
 
74
71
                                    x = planet.x,
75
72
                                    y = planet.y,
76
73
                                    rotation = planet.rotation,
77
 
                                    goods = planet.goods,
78
 
                                    name = planet.name
 
74
                                    goods = planet.goods
79
75
                                 })
80
76
                 end
81
77
 
98
94
 
99
95
                 -- load player with cargo, money, position
100
96
                 the.player = SpacePlayer:new(the.storage.data.player)
101
 
 
102
 
                 -- reload storage as we've turned it all into objects
103
 
                 the.storage:load()
104
97
              end
105
98
 
106
99
              self:add(the.planets)
107
 
              self:add(the.planetLabels)
108
100
 
109
101
              self:add(the.player)
110
102
              self:add(the.player.thrust)
128
120
              the.cursor = Cursor:new()
129
121
              self:add(the.cursor)
130
122
 
 
123
              the.over = Text:new{
 
124
                 y = the.app.height / 2,
 
125
                 width = the.app.width,
 
126
                 align = 'center',
 
127
                 font = 25,
 
128
                 text = "Game Over",
 
129
                 visible = false
 
130
              }
 
131
              the.interface:add(the.over)
 
132
 
 
133
 
 
134
              the.instructions = Text:new{
 
135
                 y = the.app.height / 2 + 32,
 
136
                 width = the.app.width,
 
137
                 align = 'center',
 
138
                 font = 12,
 
139
                 text = "Press Enter to start a new game\nPress Q to quit",
 
140
                 visible = false
 
141
              }
 
142
              the.interface:add(the.instructions)
 
143
 
131
144
              love.mouse.setGrab(true)
132
145
              love.mouse.setVisible(false)
133
146
              love.mouse.setPosition(the.app.width / 2, the.app.height / 2)
186
199
                 self.console:watch('num rocks', '#the.rocks.sprites')
187
200
                 self.console:watch('num planets', '#the.planets.sprites')
188
201
                 self.console:watch('num enemies', 'the.enemies:count()')
189
 
                 self.console:watch('onPlanet', 'the.player.onPlanet')
190
202
                 --self.console:watch('drawTook', 'the.drawTook')
191
203
 
192
204
                 -- back off that dark overlay a bit