/traderous

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

« back to all changes in this revision

Viewing changes to wrap_tile.lua

  • Committer: Josh C
  • Date: 2013-05-13 21:31:23 UTC
  • Revision ID: josh@9ix.org-20130513213123-n21tkmyb2u7xcjtz
monkey patch group to add onRemove hook.  remove mirrors on remove.

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
                  self.yMirror = nil
61
61
                  -- die?
62
62
               end
 
63
 
 
64
               if self.x ~= mirrorX and self.y ~= mirrorY then
 
65
                  if not self.xyMirror then
 
66
                     --print('creating mirror: X='..xyMirrorX..' Y='..xyMirrorY)
 
67
 
 
68
                     self.xyMirror = Tile:new{ image = self.image }
 
69
                     the.app.view:add(self.xyMirror)
 
70
                  end
 
71
 
 
72
                  self.xyMirror.x = mirrorX
 
73
                  self.xyMirror.y = mirrorY
 
74
                  self.xyMirror.rotation = self.rotation
 
75
               elseif self.xyMirror then
 
76
                  the.app.view:remove(self.xyMirror)
 
77
                  self.xyMirror = nil
 
78
                  -- die?
 
79
               end
63
80
            end,
 
81
   onRemove = function(self)
 
82
                 if self.xMirror then
 
83
                    the.app.view:remove(self.xMirror)
 
84
                 end
 
85
 
 
86
                 if self.yMirror then
 
87
                    the.app.view:remove(self.yMirror)
 
88
                 end
 
89
 
 
90
                 if self.xyMirror then
 
91
                    the.app.view:remove(self.xyMirror)
 
92
                 end
 
93
              end,
64
94
   update = function (self, elapsed)
65
95
               Tile.update(self, elapsed)
66
96