/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-14 05:24:01 UTC
  • Revision ID: josh@9ix.org-20131214052401-8b2cma95lsvw7avq
rename NotPlayer to Clone cuz they're clones, and it's way too early 
for a class name like NotPlayer.

Show diffs side-by-side

added added

removed removed

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