/spacey

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

« back to all changes in this revision

Viewing changes to wrap_tile.lua

  • Committer: Josh C
  • Date: 2013-05-14 16:39:54 UTC
  • Revision ID: josh@9ix.org-20130514163954-tpi9djio3pm6vswf
prepare a collision box for the rocks

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
                  if not self.xMirror then
32
32
                     --print('creating mirror: X='..xMirrorX..' Y='..xMirrorY)
33
33
 
34
 
                     self.xMirror = Tile:new{ image = self.image }
 
34
                     self.xMirror = Mirror:new{ of = self, image = self.image }
35
35
                     the.app.view:add(self.xMirror)
36
36
                  end
37
37
 
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
48
49
                  if not self.yMirror then
49
50
                     --print('creating mirror: X='..yMirrorX..' Y='..yMirrorY)
50
51
 
51
 
                     self.yMirror = Tile:new{ image = self.image }
 
52
                     self.yMirror = Mirror:new{ of = self, image = self.image }
52
53
                     the.app.view:add(self.yMirror)
53
54
                  end
54
55
 
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
65
67
                  if not self.xyMirror then
66
68
                     --print('creating mirror: X='..xyMirrorX..' Y='..xyMirrorY)
67
69
 
68
 
                     self.xyMirror = Tile:new{ image = self.image }
 
70
                     self.xyMirror = Mirror:new{ of = self, image = self.image }
69
71
                     the.app.view:add(self.xyMirror)
70
72
                  end
71
73
 
72
74
                  self.xyMirror.x = mirrorX
73
75
                  self.xyMirror.y = mirrorY
74
76
                  self.xyMirror.rotation = self.rotation
 
77
                  self.xyMirror.scale = self.scale
75
78
               elseif self.xyMirror then
76
79
                  the.app.view:remove(self.xyMirror)
77
80
                  self.xyMirror = nil
78
81
                  -- die?
79
82
               end
80
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,
81
97
   update = function (self, elapsed)
82
98
               Tile.update(self, elapsed)
83
99
 
84
100
               self:wrap()
85
101
               self:reflect()
86
 
 
87
 
               -- TODO: make sure mirrors are cleaned up when we are
88
 
               -- killed / removed from view
89
102
            end
90
103
}
 
 
b'\\ No newline at end of file'