[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Looking for examples: animation with coroutines
- From: Gedalia Pasternak <gedalia@...>
- Date: Tue, 5 Feb 2013 12:28:11 -0500
What I do for the AI/Human sim product I work on (http://www.diguy.com/) is give each person their own associated lua object and that has a coroutine. They then do things like:
move_to_point(x,y,z)
which calls a C++ path planner and yields the coroutine.
the coroutine then sleeps till c++ wakes the person back up (aka coroutine resume) when the destination point has been reached.
It lets the high level lua code handle the object's state machine which is really hard to write in C++. And C++ do simple movement stuff, I also have simple timers and other wake up system for messaging and such.
-Gedalia
--
---------------------------------------------------------------
http://www.gedalia.net
---------------------------------------------------------------
Fight Entropy!!! Fight Entropy!!! Figth Etnropy! !
iFgth Etnrop!y ! giFth tErno!py ! giFt htrEno!p y! --- Well maybe
not...