5 ms·
In games, you can use a generator function for stuff that's supposed to take multiple frames. Saves you from either having to write a whole state machine system
by jtolmar 4y ago
In games, you can use a generator function for stuff that's supposed to take multiple frames. Saves you from either having to write a whole state machine system, or extracting all the state for every multi-frame action out into the object.
- Dylan16807 4y agoYeah, for things split across animation frames it's great to have the ability to trigger .next() exactly when and where you want to, while still writing straight-line stateful code. Await lets you do the latter, but not the former.
- int_19h 4y agoWouldn't it be better to use async/await for that?