/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-30 21:40:01 UTC
  • Revision ID: josh@9ix.org-20130630214001-qb2ykjjrolqm1mzx
recenter mouse on respawn

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'
23
25
 
24
26
util = {
25
27
   signOf = function(value)
43
45
              the.bullets = Group:new()
44
46
              the.interface = Group:new()
45
47
              the.planets = Group:new()
 
48
              the.planetLabels = Group:new()
46
49
              the.indicators = Group:new()
47
50
              the.enemies = Group:new()
48
51
 
71
74
                                    x = planet.x,
72
75
                                    y = planet.y,
73
76
                                    rotation = planet.rotation,
74
 
                                    goods = planet.goods
 
77
                                    goods = planet.goods,
 
78
                                    name = planet.name
75
79
                                 })
76
80
                 end
77
81
 
94
98
 
95
99
                 -- load player with cargo, money, position
96
100
                 the.player = SpacePlayer:new(the.storage.data.player)
 
101
 
 
102
                 -- reload storage as we've turned it all into objects
 
103
                 the.storage:load()
97
104
              end
98
105
 
99
106
              self:add(the.planets)
 
107
              self:add(the.planetLabels)
100
108
 
101
109
              self:add(the.player)
102
110
              self:add(the.player.thrust)
120
128
              the.cursor = Cursor:new()
121
129
              self:add(the.cursor)
122
130
 
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
 
 
144
131
              love.mouse.setGrab(true)
145
132
              love.mouse.setVisible(false)
146
133
              love.mouse.setPosition(the.app.width / 2, the.app.height / 2)
199
186
                 self.console:watch('num rocks', '#the.rocks.sprites')
200
187
                 self.console:watch('num planets', '#the.planets.sprites')
201
188
                 self.console:watch('num enemies', 'the.enemies:count()')
 
189
                 self.console:watch('onPlanet', 'the.player.onPlanet')
202
190
                 --self.console:watch('drawTook', 'the.drawTook')
203
191
 
204
192
                 -- back off that dark overlay a bit