LoveCoroutine: a simple tool based on coroutine for LÖVE

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
padicao2010
Prole
Posts: 15
Joined: Wed Jan 15, 2014 8:38 am

LoveCoroutine: a simple tool based on coroutine for LÖVE

Post by padicao2010 »

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:

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 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:
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 64 guests