Chapter     8

Let’s Play! Scripting the Game

Our 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, FuguBowl.js, which will be filled out with the complete logic for a bowling game laid out as states in a finite state machine (FSM). Just the scoring rules are complicated enough, so those will be encapsulated in a script named FuguBowlPlayer.js.

The ...

Get Learn Unity 4 for iOS Game Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.