Chapter 3, Exercise 3 – Game Object Design
Bubble Shooter has a simple object structure that consists of a Game, a Board, and a set of Bubbles. What sort of objects would you need if you were building a game like Angry Birds, Bejeweled, or Candy Crush?
Taking Bejewelled as an example: analogous to Bubble Shooter, we would probably want a Board class. As the explosion effects in Bejewelled cause more gems to drop into columns we might want to model a Column class, rather than relying on Array, so that we can add methods for queueing new gems and handling how they drop.
As gems come in many different types, we could create a single Gem class and assign variables to establish their color and properties, or we could create multiple classes such as SimpleGem, GlowingGem, CubeGem etc to handle the way they react differently to being swapped.
Leave a Reply