Chapter 8. Time, Part I: Finite Behaviors and Linear Motion

Topics in This Chapter

8.1 Implement an Initial Jump Algorithm

8.2 Shift Responsibility for Jumping to the Runner

8.3 Implement the Jump Behavior

8.4 Time Animations with Stopwatches

8.5 Refine the Jump Behavior

8.6 Implement Linear Motion

8.7 Pause Behaviors

8.8 Conclusion

8.9 Exercises

The last chapter discussed how to encapsulate actions—such as running, falling, pacing, or sparkling—that sprites undertake in JavaScript objects known as behaviors. At runtime, you can configure a sprite’s array of behaviors however you desire. Among its many benefits, that flexibility encourages exploration of game aspects that might otherwise lie dormant.

This chapter continues to ...

Get Core HTML5 2D Game Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.