3
width = 16, height = 16,
5
self.direction = dirs[math.random(1,4)]
7
doMove = function(self)
8
if math.random(1,4) == 1 then -- change direction ~25%
9
self.direction = dirs[math.random(1,4)]
12
if self.direction == 'left' then
13
self.x = self.x - self.width
14
elseif self.direction == 'right' then
15
self.x = self.x + self.width
16
elseif self.direction == 'up' then
17
self.y = self.y - self.height
18
elseif self.direction == 'down' then
19
self.y = self.y + self.height
22
onCollide = function(self, other)
23
if other ~= the.view.map then
26
other:displaceDir(self,
27
util.dirToXY(self.direction),
28
- util.dirToPosNeg(self.direction))
b'\\ No newline at end of file'