/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 22:25:16 UTC
  • Revision ID: josh@9ix.org-20130513222516-wem0v29pit3ivc6w
rocks!

Show diffs side-by-side

added added

removed removed

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