24 lines
505 B
Lua
24 lines
505 B
Lua
local mkHopper = require "hopper"
|
|
local dirs = {"se", "sw", "ne", "nw"}
|
|
local height = 10;
|
|
|
|
return function(arena)
|
|
local self
|
|
local function update(dt, se, sw)
|
|
if se+sw >= arena.getSize() then
|
|
self.dead = true
|
|
return
|
|
end
|
|
|
|
local dir = dirs[math.random(2)]
|
|
self.jump(dir)
|
|
end
|
|
local function draw(x, y )
|
|
love.graphics.setColor(128,0,0);
|
|
love.graphics.circle("fill", x, y, height)
|
|
end
|
|
|
|
self = mkHopper(arena, draw, update)
|
|
return self
|
|
end
|