Chapter 7. Sprite Behaviors

Topics in This Chapter

7.1 Behavior Fundamentals

7.2 Runner Behaviors

7.3 The Runner’s Run Behavior

7.4 Flyweight Behaviors

7.5 Game-Independent Behaviors

7.6 Combine Behaviors

7.7 Conclusion

7.8 Exercises

Great stories have great characters. And like books and movies, video games also need characters with interesting behaviors. For example, the protagonist in Braid—one of the most popular platform games of all time—can manipulate time. That ingenious behavior set the game apart from its contemporaries.

Behaviors are the soul of any video game, and adding behaviors to Snail Bait’s inert sprites immediately makes the game more interesting, as shown in Figure 7.1.

Figure 7.1 Sprites with behaviors

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.