LoveCoroutine: a simple tool based on coroutine for LÖVE
Posted: Tue Jan 12, 2016 3:26 am
Recently, I do some practise on lua.coroutine and implement LoveCoroutine.
It is a simple tool based on coroutine and targets at implementing a serial of actions in a straightforward and human-readable way.
for example:
For now, LoveCoroutine provides waitNextFrame to iterate every frame, waitTime to sleep for a given time, waitSignal and sendSignal to act as a simple event system. Besides, stop/resume is supported.
For more detail, read here.
However, it seems just a practise. It needs more test and improvement. I need help to make it suitable for game development.
Reference projects:
It is a simple tool based on coroutine and targets at implementing a serial of actions in a straightforward and human-readable way.
for example:
Code: Select all
local lc = require("LoveCoroutine")()
lc:run(function()
A:moveDown()
lc:waitTime(3)
A:moveRight()
lc:waitTime(2)
A:moveDown()
lc:waitTime(1)
-- Other actions
end)
function love.update(dt)
lc:update(dt)
end
For more detail, read here.
However, it seems just a practise. It needs more test and improvement. I need help to make it suitable for game development.
Reference projects: