31
31
if not self.xMirror then
32
32
--print('creating mirror: X='..xMirrorX..' Y='..xMirrorY)
34
self.xMirror = Tile:new{ image = self.image }
35
the.app.view:add(self.xMirror)
34
self.xMirror = Mirror:new{ of = self, image = self.image }
35
the.mirrors:add(self.xMirror)
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
the.app.view:remove(self.xMirror)
43
the.mirrors:remove(self.xMirror)
48
49
if not self.yMirror then
49
50
--print('creating mirror: X='..yMirrorX..' Y='..yMirrorY)
51
self.yMirror = Tile:new{ image = self.image }
52
the.app.view:add(self.yMirror)
52
self.yMirror = Mirror:new{ of = self, image = self.image }
53
the.mirrors:add(self.yMirror)
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
the.app.view:remove(self.yMirror)
61
the.mirrors:remove(self.yMirror)
66
if self.x ~= mirrorX and self.y ~= mirrorY then
67
if not self.xyMirror then
68
--print('creating mirror: X='..xyMirrorX..' Y='..xyMirrorY)
70
self.xyMirror = Mirror:new{ of = self, image = self.image }
71
the.mirrors:add(self.xyMirror)
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.mirrors:remove(self.xyMirror)
84
onRemove = function(self)
86
the.mirrors:remove(self.xMirror)
90
the.mirrors:remove(self.yMirror)
94
the.mirrors:remove(self.xyMirror)
64
97
update = function (self, elapsed)
65
98
Tile.update(self, elapsed)
70
-- TODO: make sure mirrors are cleaned up when we are
71
-- killed / removed from view
b'\\ No newline at end of file'