1
local dirs = {'left', 'right', 'up', 'down'}
5
width = 16, height = 16,
8
self.direction = dirs[math.random(1,4)]
10
doMove = function(self)
11
if math.random(1,4) == 1 then -- change direction ~25%
12
self.direction = dirs[math.random(1,4)]
15
if self.direction == 'left' then
16
self.x = self.x - self.width
17
elseif self.direction == 'right' then
18
self.x = self.x + self.width
19
elseif self.direction == 'up' then
20
self.y = self.y - self.height
21
elseif self.direction == 'down' then
22
self.y = self.y + self.height
25
onCollide = function(self, other)
b'\\ No newline at end of file'