/ld26

To get this branch, use:
bzr branch /bzr/ld26
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Transition = Group:extend {
   visible = false,
   onNew = function(self)
              local target = self.target
              -- NOTE: X/Y will fail if you init Transition before Player!
              box = Fill:new{x = self.x, y = self.y,
                             height = the.player.height,
                             width = the.player.width,
                             fill = {0, 255, 0},
                             onCollide = function(self, other, xOl, yOl)
                                            -- (sanity check)
                                            if other == the.player then
                                               the.view:newLevel(target)
                                            else
                                               print("Colliding with: "..other)
                                            end
                                         end
                          }
              self:add(box)
              self:add(Text:new{x = self.x, y = self.y,
                                text = "T"
                             })
           end,
   onUpdate = function(self, dt)
                 self.visible = DEBUG and the.console.visible
              end
}