/ld28

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

« back to all changes in this revision

Viewing changes to clone.lua

  • Committer: Josh C
  • Date: 2013-12-15 02:57:38 UTC
  • Revision ID: josh@9ix.org-20131215025738-8hnrktimbqwt81h9
clones you flip don't flip back

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
local dirs = {'left', 'right', 'up', 'down'}
2
 
 
3
 
Clone = Fill:extend {
4
 
   fill = {255,0,0},
5
 
   width = 16, height = 16,
6
 
   queue = deque.new(),
 
1
Clone = Tile:extend {
 
2
   image = 'data/player.png',
7
3
   onNew = function(self)
8
4
              self.direction = dirs[math.random(1,4)]
9
5
           end,
23
19
               end
24
20
            end,
25
21
   onCollide = function(self, other)
26
 
                  other:displace(self)
 
22
                  if other ~= the.view.map then
 
23
                     --print('collision')
 
24
 
 
25
                     other:displaceDir(self,
 
26
                                       util.dirToXY(self.direction),
 
27
                                       - util.dirToPosNeg(self.direction))
 
28
                  end
 
29
 
 
30
                  if other == the.player then
 
31
                     self.image = 'data/player.png'
 
32
                     self.cured = true
 
33
                  end
27
34
               end
28
35
}
 
 
b'\\ No newline at end of file'