/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 23:43:03 UTC
  • Revision ID: josh@9ix.org-20130427234303-35drcx68t13gb3b8
more transitions and collisions

Show diffs side-by-side

added added

removed removed

1
1
Transition = Group:extend {
2
2
   visible = false,
3
3
   onNew = function(self)
4
 
              local target = self.target
 
4
              local t = self
5
5
              -- NOTE: X/Y will fail if you init Transition before Player!
6
6
              box = Fill:new{x = self.x, y = self.y,
7
7
                             height = self.height or the.player.height,
10
10
                             onCollide = function(self, other, xOl, yOl)
11
11
                                            -- (sanity check)
12
12
                                            if other == the.player then
13
 
                                               the.view:newLevel(target)
 
13
                                               the.view:newLevel(t.target)
 
14
                                               if t.targetX or t.targetY then
 
15
                                                  the.player.x = t.targetX
 
16
                                                  the.player.y = t.targetY
 
17
                                               end
14
18
                                            else
15
19
                                               print("Colliding with: "..other)
16
20
                                            end