/traderous

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

« back to all changes in this revision

Viewing changes to shield.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:
7
7
      'data/shield.png'
8
8
   },
9
9
   strength = 5,
 
10
   max = 5,
10
11
   velocity = {rotation = 5},
11
 
   visible = false,
 
12
   cost = 100, -- cost to repair 1 shield strength
12
13
   setImage = function (self)
13
14
                 if self.strength < 1 or self.strength == 5 then
14
15
                    self.visible = false
20
21
              end,
21
22
   onHit = function (self)
22
23
              self.strength = self.strength - 1
23
 
              self:setImage()
24
24
           end,
25
25
   onUpdate = function (self)
 
26
                 self:setImage()
 
27
 
26
28
                 self.x = self.ship.x - 16
27
29
                 self.y = self.ship.y - 16
28
30