/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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Flower = Tile:extend{
   image = 'data/flower32.png',
   name = 'flower',
   invTile = Tile:new{image = 'data/flower.png'},
   onNew = function(self)
              --print(self.x, self.y, self.width, self.height)
           end,
   onCollide = function(self, other, xOl, yOl)
                  if other == the.player then
                     the.inventory:add(self)
                     the.app.view:remove(self)
                  end
               end
}

Fish = Sprite:extend{
   name = 'fish',
   invTile = Tile:new{image = 'data/fish.png'},
   onNew = function(self)
              --print(self.x, self.y, self.width, self.height)
           end,
   onCollide = function(self, other, xOl, yOl)
                  if other == the.player then
                     the.inventory:add(self)
                     the.app.view:remove(self)
                  end
               end
}

Flag = Sprite:extend{
   name = 'flag',
   invTile = Tile:new{image = 'data/flag.png'},
   onCollide = function(self, other, xOl, yOl)
                  if the.inventory.items['flower'] then
                     the.inventory:add(self)
                     --the.app.view:remove(self)

                     the.inventory:remove('flower')
                  end

                  self:displace(other)
               end
}

Fairy = Sprite:extend{
   name = 'fairy',
   invTile = Tile:new{image = 'data/fairy.png'},
   onCollide = function(self, other, xOl, yOl)
                  if the.inventory.items['cat'] then
                     the.inventory:add(self)

                     the.inventory:remove('cat')
                  end

                  self:displace(other)
               end
}

Cat = Tile:extend{
   image = 'data/cat.png',
   name = 'cat',
   invTile = Tile:new{image = 'data/cat48.png'},
   onNew = function(self)
              --print(self.x, self.y, self.width, self.height)
           end,
   onCollide = function(self, other, xOl, yOl)
                  if other == the.player then
                     the.inventory:add(self)
                     the.app.view:remove(self)
                  end
               end
}