Tower Defense Game: Animation and Kinematics
A tower defense game needs movement: the enemies should lumber across the battle field, and our turrets’ vision should sweep menacingly, looking for targets to fire its projectiles at.
Meanwhile, we need to think about path finding and animation, too. They’re all related, actually, because it’s about motion — kinematics.
All these things take place over seconds and minutes, which we must encapsulate into a system that works with our game loop and our desired frame rate. There’s many ways to do this, like for loops with accumulator variables to hold the state. But there’s another way to do it: with
itertools, generators and lazy evaluation.