Currently this alpha version supports:
- Setting a continuous path and setting an object to loop it.
- shapes includes: lines and arcs
- Doesn't break even if the delta time increases significantly
- Expand path on the fly.
- Draw the path
Usage Note:
Simply download the library and add it to your project file, add the line:
Code: Select all
require 'path'
Then proceed to create an object for the path, and use the newPath function to create a new path, setMovement to prepare the movement and follow to follow it. Such as
Code: Select all
require 'path'
function love.load()
path1=newPath(3,2,6,2,8,4,'arc',7,5,.1,false,'arc',6,5,.5,true,6,7,'arc',3,7,3,true,'arc',3,2,7,false)
path1:setMovement(5,true)
end
function love.update(dt)
path1:follow(dt)
end
function love.draw()
love.graphics.scale(40)
love.graphics.setLineWidth(0.05)
love.graphics.circle('fill', path1.x,path1.y,.25)
for i = 0,20,1 do
love.graphics.line(0,i,50,i)
love.graphics.line(i,0,i,50)
end
love.graphics.setColor(255,0,0)
path1:draw()
love.graphics.setColor(255,255,255)
--you only need path1:draw(), but the rest helps with the example
--also adds grid lines.
end
Code: Select all
newPath(x1,y1,x,y,x,y,'arc',x,y,width,flipped,x,y,x,y)
Upcoming and planned features includes
- Multiple objects on the same path (top priority)
- Acceleration and Deceleration support.
- More shapes, suggest ideas and needs.
- General optimizations and cleaner code for clarity.