/ld26

To get this branch, use:
bzr branch http://9ix.org/bzr/ld26

« back to all changes in this revision

Viewing changes to items.lua

  • Committer: Josh C
  • Date: 2013-04-28 23:19:25 UTC
  • Revision ID: josh@9ix.org-20130428231925-m2rgt3n1dg9gryz2
cat

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Flower = Tile:extend{
 
2
   image = 'data/flower32.png',
 
3
   name = 'flower',
 
4
   invTile = Tile:new{image = 'data/flower.png'},
 
5
   onNew = function(self)
 
6
              --print(self.x, self.y, self.width, self.height)
 
7
           end,
 
8
   onCollide = function(self, other, xOl, yOl)
 
9
                  if other == the.player then
 
10
                     the.inventory:add(self)
 
11
                     the.app.view:remove(self)
 
12
                  end
 
13
               end
 
14
}
 
15
 
 
16
Fish = Sprite:extend{
 
17
   name = 'fish',
 
18
   invTile = Tile:new{image = 'data/fish.png'},
 
19
   onNew = function(self)
 
20
              --print(self.x, self.y, self.width, self.height)
 
21
           end,
 
22
   onCollide = function(self, other, xOl, yOl)
 
23
                  if other == the.player then
 
24
                     the.inventory:add(self)
 
25
                     the.app.view:remove(self)
 
26
                  end
 
27
               end
 
28
}
 
29
 
 
30
Flag = Sprite:extend{
 
31
   name = 'flag',
 
32
   invTile = Tile:new{image = 'data/flag.png'},
 
33
   onCollide = function(self, other, xOl, yOl)
 
34
                  if the.inventory.items['flower'] then
 
35
                     the.inventory:add(self)
 
36
                     --the.app.view:remove(self)
 
37
 
 
38
                     the.inventory:remove('flower')
 
39
                  end
 
40
 
 
41
                  self:displace(other)
 
42
               end
 
43
}
 
44
 
 
45
Cat = Tile:extend{
 
46
   image = 'data/cat.png',
 
47
   name = 'cat',
 
48
   invTile = Tile:new{image = 'data/cat48.png'},
 
49
   onNew = function(self)
 
50
              --print(self.x, self.y, self.width, self.height)
 
51
           end,
 
52
   onCollide = function(self, other, xOl, yOl)
 
53
                  if other == the.player then
 
54
                     the.inventory:add(self)
 
55
                     the.app.view:remove(self)
 
56
                  end
 
57
               end
 
58
}