/traderous

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

« back to all changes in this revision

Viewing changes to game_over.lua

  • Committer: Josh C
  • Date: 2013-06-16 02:57:09 UTC
  • Revision ID: josh@9ix.org-20130616025709-wt230osrvs3w0scq
status of what player has

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
GameOver = Group:extend {
2
 
   onNew = function (self)
3
 
              self.died = love.timer.getTime()
4
 
 
5
 
              local boxW = 200
6
 
              local boxH = 70
7
 
              local boxL = the.app.width / 2 - boxW / 2
8
 
              local boxT = the.app.height / 2 - boxH / 2
9
 
              local boxR = boxL + boxW
10
 
              local boxB = boxT + boxH
11
 
              self.boxT = boxT
12
 
 
13
 
              local lh = 26 -- line height
14
 
 
15
 
              self:add(Fill:new{
16
 
                          fill = {255,255,255},
17
 
                          x = boxL - 1,
18
 
                          y = boxT - 1,
19
 
                          width = boxW + 2,
20
 
                          height = boxH + 2,
21
 
                       })
22
 
 
23
 
              self:add(Fill:new{
24
 
                          fill = {0,0,0},
25
 
                          x = boxL,
26
 
                          y = boxT,
27
 
                          width = boxW,
28
 
                          height = boxH,
29
 
                       })
30
 
 
31
 
              self:add(Text:new{
32
 
                          text = 'You died',
33
 
                          x = boxL,
34
 
                          y = boxT + 10,
35
 
                          width = boxW,
36
 
                          font = 16,
37
 
                          align = 'center'
38
 
                       })
39
 
 
40
 
              self.timer = Text:new{
41
 
                 text = 'Respawning in ...',
42
 
                 x = boxL,
43
 
                 y = boxT + 40,
44
 
                 width = boxW,
45
 
                 font = 16,
46
 
                 align = 'center'
47
 
              }
48
 
              self:add(self.timer)
49
 
           end,
50
 
   onUpdate = function (self)
51
 
                 local time = math.floor(self.died + 5 - love.timer.getTime())
52
 
 
53
 
                 self.timer.text = 'Respawning in ' .. time .. '...'
54
 
 
55
 
                 if time <= 0 then
56
 
                    local m = math.ceil(the.player.money * .8)
57
 
                    the.player = SpacePlayer:new{
58
 
                       x = the.storage.data.player.x,
59
 
                       y = the.storage.data.player.y,
60
 
                       money = m,
61
 
                       cargoSpace = the.storage.data.player.cargoSpace
62
 
                    }
63
 
                    the.app.view:add(the.player)
64
 
                    the.app.view:add(the.player.thrust)
65
 
                    the.app.view:add(the.player.shield)
66
 
 
67
 
                    the.app.view.focus = the.player
68
 
 
69
 
                    the.interface:remove(self)
70
 
                 end
71
 
              end
72
 
}
 
 
b'\\ No newline at end of file'