We had a refresher session on arrays, loops and functions. My primary takeaways were:
- Using nested loops as a way to operate between multiple arrays simultaneously
- Invoking anonymous functions to be used as callbacks during regular function calls
- Using self-invoking functions to iterate their result
Discussion time-based vs frame-based animations gave me insight into which methods can be more efficient for different game types; simulation games benefit from time based animation to get maximum yield out of high end devices, while fps games can use frame-based animation to ensure consistent action.
Easing functions are very useful for providing accurate physics for moving objects. I studied ease in+out sine waves, bounce out waves and spring based easing functions – used respectively for objects accelerating/decelerating from rest, bouncy objects that gain height every leap and self-explanatory spring objects. Bouncing uses a complicated nested if statement sequence to determine the previous height of the object and produce a new value based on its current trajectory.