Let’s Play! Scripting the Game
Your bowling game that has been taking shape over the past few chapters is starting to actually look like a bowling game! It has a bowling ball, bowling pins (or rather, the barrels added in the previous chapter), game controls, and game physics. But it’s still more a toy than a game since it lacks game rules and scoring. That will be remedied in this chapter with a healthy dose of scripting. Most of that will take place in the game controller script, FuguBowlPlayer.js, which will be filled out with the complete logic for a bowling game laid out as states in a finite state machine (FSM). The scoring rules are complicated, so those will be encapsulated in a script named FuguBowlPlayer.js.