A Simple Game Animation
With these preliminaries out of the way, we’re ready to tackle an actual problem that a typical Lua hacker might face. Lua is often used as a scripting language for games. These days, games often include particle systems that generate organic-looking graphical effects. I’ve always wanted to build a particle emitter, so today I’m going to start a fire, functional style!
A functional particle system wouldn’t retain mutable state, so it might be a function that accepts state (particles) as an argument and produces new state (new particles).
But before I can start writing my particle system, I need something capable of drawing. I was without my computer this weekend, so that gave me an excuse to use Codea,[34] a cute ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access