1
1
Transition = Group:extend {
3
3
onNew = function(self)
5
-- NOTE: X/Y will fail if you init Transition before Player!
6
box = Fill:new{x = self.x, y = self.y,
7
height = self.height or the.player.height,
8
width = self.width or the.player.width,
10
onCollide = function(self, other, xOl, yOl)
12
if other == the.player then
13
--print("Sending to "..t.target)
15
the.player.active = false
16
the.app.view:fade({0,0,0}):andThen(function()
17
the.app.view = GameView:new{level = t.target}
19
if t.targetX or t.targetY then
20
the.player.x = t.targetX
21
the.player.y = t.targetY
25
print("Colliding with: "..other)
30
self:add(Text:new{x = self.x, y = self.y,
34
-- make sure collision doesn't think group is a sprite
35
self.x, self.y, self.width, self.height = nil, nil, nil, nil
5
-- NOTE: X/Y will fail if you init Transition before Player!
6
box = Fill:new{x = self.x, y = self.y,
7
height = self.height or the.player.height,
8
width = self.width or the.player.width,
10
onCollide = function(self, other, xOl, yOl)
12
if other == the.player then
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
19
print("Colliding with: "..other)
24
self:add(Text:new{x = self.x, y = self.y,
28
-- make sure collision doesn't think group is a sprite
29
self.x, self.y, self.width, self.height = nil, nil, nil, nil
37
31
onUpdate = function(self, dt)
38
32
self.visible = DEBUG and the.console.visible