/traderous

To get this branch, use:
bzr branch http://9ix.org/bzr/traderous

« back to all changes in this revision

Viewing changes to trade_view.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:
132
132
              self:add(b)
133
133
 
134
134
              local sh = the.player.shield
 
135
              local cost = (sh.max - sh.strength) * sh.cost
 
136
              b = Button:new{
 
137
                 x = boxL, y = boxT,
 
138
                 width = 800,
 
139
                 -- WTF: trailing space makes it not wrap?
 
140
                 label = Text:new{ text = 'Repair shields (' .. cost .. ') ',
 
141
                                   x = 3, y = 2 },
 
142
                 onMouseDown = function(self)
 
143
                                  if the.player.money >= cost and sh.strength < sh.max then
 
144
                                     the.player.money = the.player.money - cost
 
145
                                     sh.strength = sh.max
 
146
                                     self.visible = false
 
147
                                  end
 
148
                               end
 
149
              }
 
150
 
 
151
              local tw, th = b.label:getSize()
 
152
              b.background = Fill:new{
 
153
                 fill = {100,100,100},
 
154
                 width = tw + 3,
 
155
                 height = th + 4
 
156
              }
 
157
              b.x = boxR - b.background.width - 60
 
158
              b.y = boxB - b.background.height - 10
 
159
 
135
160
              if sh.strength < sh.max then
136
 
                 sh.strength = sh.max
137
 
 
138
 
                 self:add(Text:new{
139
 
                             text = 'Your shield has been recharged',
140
 
                             width = 450,
141
 
                             align = 'center',
142
 
                             x = boxL,
143
 
                             y = boxB - 4 * th - 12
144
 
                          })
 
161
                 self:add(b)
145
162
              end
146
163
 
147
 
              -- local cost = (sh.max - sh.strength) * sh.cost
148
 
              -- b = Button:new{
149
 
              --    x = boxL, y = boxT,
150
 
              --    width = 800,
151
 
              --    -- WTF: trailing space makes it not wrap?
152
 
              --    label = Text:new{ text = 'Repair shields (' .. cost .. ') ',
153
 
              --                      x = 3, y = 2 },
154
 
              --    onMouseDown = function(self)
155
 
              --                     if the.player.money >= cost and sh.strength < sh.max then
156
 
              --                        the.player.money = the.player.money - cost
157
 
              --                        sh.strength = sh.max
158
 
              --                        self.visible = false
159
 
              --                     end
160
 
              --                  end
161
 
              -- }
162
 
 
163
 
              -- local tw, th = b.label:getSize()
164
 
              -- b.background = Fill:new{
165
 
              --    fill = {100,100,100},
166
 
              --    width = tw + 3,
167
 
              --    height = th + 4
168
 
              -- }
169
 
              -- b.x = boxR - b.background.width - 60
170
 
              -- b.y = boxB - b.background.height - 10
171
 
 
172
 
              -- if sh.strength < sh.max then
173
 
              --    self:add(b)
174
 
              -- end
175
 
 
176
164
              self.playerMoney = Text:new{
177
165
                 text = 'Your money: ',
178
166
                 width = 200,
189
177
              }
190
178
              self:add(self.availSpace)
191
179
 
192
 
              if the.player.kills > 0 then
193
 
                 -- local award = the.player.kills * 100
194
 
                 -- self:add(Text:new{
195
 
                 --             text = 'You have been awarded ' ..
196
 
                 --                award ..
197
 
                 --                ' credits for killing bandits.',
198
 
                 --             width = 450,
199
 
                 --             align = 'center',
200
 
                 --             x = boxL,
201
 
                 --             y = boxB - 4 * th - 12
202
 
                 --          })
203
 
 
204
 
                 -- the.player.money = the.player.money + award
205
 
                 the.player.kills = 0
206
 
              end
207
 
 
208
180
              -- give the buttons a cycle to get out of the T/L corner
209
181
              self:update(0)
210
182
           end,
217
189
                 Subview.activate(self)
218
190
              end,
219
191
   close = function (self)
220
 
              the.player:save()
221
 
 
222
192
              the.cursor.visible = true
223
193
              love.mouse.setVisible(false)
224
194
              love.mouse.setGrab(true)