Code: Select all
mobs = {}
mobs.spawn = {}
--Follower of Anasi
mobs.FoA = {
health = 50,
mana = 70,
speed = 350,
attack = math.random(5,15)}
function mobs.spawn.FoA(x,y,actx,acty,actx2)
table.insert(mobs.FoA, {x = x, y = y})
mobs.FoA.body = love.physics.newBody(world, mobs.FoA.x, mobs.FoA.y, "dynamic")
mobs.FoA.shape = love.physics.newCircleShape(18)
mobs.FoA.fixture = love.physics.newFixture(mobs.FoA.body, mobs.FoA.shape)
end
function mobs.FoA.AI(dt,actx,acty,actx2)
if char_selection == 1 then
if Max_b:getX() > actx or Max_b:getX() < actx2 then
for i, FoA in ipairs(mobs.FoA) do
dx = FoA.x - Max_b:getX()
dy = FoA.y - Max_b:getY()
dist = math.sqrt(dx^2+dy^2)
FoA.x = FoA.x + dx/dist * FoA.speed * dt
FoA.y = FoA.y + dy/dist * FoA.speed * dt
end
end
end
end
function mobs.FoA.draw()
lg.setColor(200, 0, 0)
lg.circle("fill", mobs.FoA.body:getX(), mobs.FoA.body:getY(), mobs.FoA.shape:getRadius())
lg.setColor(255,255,255)
end