/ld26

To get this branch, use:
bzr branch /bzr/ld26

« back to all changes in this revision

Viewing changes to transition.lua

  • Committer: Josh C
  • Date: 2013-04-27 19:55:06 UTC
  • Revision ID: josh@9ix.org-20130427195506-xd6p6y8druwyt2sz
area transitions

Show diffs side-by-side

added added

removed removed

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