[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Has anyone played with theis 2D Engine
- From: Evan DeMond <evan.demond@...>
- Date: Thu, 19 Mar 2009 09:41:56 -0400
LOVE is nice. I've done some further experiments with it since the time of that post...
The only hurdle I had to jump was this: suddenly you realize you don't have a way to sequence events chronologically, because in LOVE, the only notion of time is "now." In the callbacks from the system each cycle, you're supposed to do a finite amount of work and get out, because the screen won't refresh until the next time you get the callback. So I didn't see any sustainable way to do, say, "start animation x, wait 10 seconds, then start animation y."
To solve this, I built a little "actors" system using coroutines. The state of each game object is preserved by a coroutine, which yields after each step. Then, each update() and draw() callback just steps all the actors. This lets you sequence events by creating an actor that's just a "script", starting other actors, and waiting by just doing a coroutine.yield for a number of cycles. Let me know if anyone is interested in that code; haven't placed it anywhere public yet.
It's fortunate that LOVE's scripting language is Lua...