added randomness to worm length
This commit is contained in:
@@ -35,10 +35,11 @@ function Worm.new(game, length)
|
||||
local self = setmetatable(LoveNode.new(), Worm)
|
||||
self.game = game
|
||||
|
||||
local defaultLength = math.floor(lume.random(4, 15))
|
||||
self.stats = {
|
||||
spawnDistanceFromPlayer = 5 * TILE_SIZE,
|
||||
moveDelay = 1, -- Seconds between movement steps
|
||||
tailLength = length or 7
|
||||
moveDelay = 0.2, -- Seconds between movement steps
|
||||
tailLength = length or defaultLength
|
||||
}
|
||||
|
||||
self.size = {}
|
||||
@@ -105,28 +106,6 @@ function Worm:draw()
|
||||
end
|
||||
love.graphics.draw(spriteBatch)
|
||||
end
|
||||
|
||||
-- Debug draw potential collisions
|
||||
-- love.graphics.setColor(0.88, 0.22, 0.22, 0.8)
|
||||
-- for _, d in ipairs(debugDirs) do
|
||||
-- if (d.pos) then
|
||||
-- love.graphics.rectangle('fill', d.pos.x, d.pos.y, d.size.w, d.size.h)
|
||||
-- else
|
||||
-- love.graphics.circle('fill', d[1], d[2], 4)
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- local cx, cy = self:getCenter()
|
||||
-- love.graphics.setColor(0.88, 0, 0)
|
||||
-- for _, dir in ipairs(directions) do
|
||||
-- local dx, dy = unpack(dir)
|
||||
-- local x, y = cx + (dx * TILE_SIZE), cy + (dy * TILE_SIZE)
|
||||
-- love.graphics.circle('line', x, y, 2)
|
||||
-- end
|
||||
|
||||
-- Debug draw center
|
||||
-- love.graphics.setColor(1, 1, 1)
|
||||
-- love.graphics.circle('fill', cx, cy, 4)
|
||||
end
|
||||
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user