/ld28

To get this branch, use:
bzr branch http://9ix.org/bzr/ld28
18 by Josh C
clones turning into fake goals
1
Clone = Tile:extend {
2
   image = 'data/player.png',
5 by Josh C
move clones a little more like players move
3
   onNew = function(self)
4
              self.direction = dirs[math.random(1,4)]
5
           end,
3 by Josh C
add a couple other clones that move randomly
6
   doMove = function(self)
5 by Josh C
move clones a little more like players move
7
               if math.random(1,4) == 1 then -- change direction ~25%
8
                  self.direction = dirs[math.random(1,4)]
9
               end
3 by Josh C
add a couple other clones that move randomly
10
5 by Josh C
move clones a little more like players move
11
               if self.direction == 'left' then
3 by Josh C
add a couple other clones that move randomly
12
                  self.x = self.x - self.width
5 by Josh C
move clones a little more like players move
13
               elseif self.direction == 'right' then
3 by Josh C
add a couple other clones that move randomly
14
                  self.x = self.x + self.width
5 by Josh C
move clones a little more like players move
15
               elseif self.direction == 'up' then
3 by Josh C
add a couple other clones that move randomly
16
                  self.y = self.y - self.height
5 by Josh C
move clones a little more like players move
17
               elseif self.direction == 'down' then
3 by Josh C
add a couple other clones that move randomly
18
                  self.y = self.y + self.height
19
               end
9 by Josh C
collision
20
            end,
21
   onCollide = function(self, other)
10 by Josh C
collide w/ the map
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
18 by Josh C
clones turning into fake goals
29
30
                  if other == the.player then
31
                     self.image = 'data/player.png'
32
                  end
9 by Josh C
collision
33
               end
3 by Josh C
add a couple other clones that move randomly
34
}