Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

Share this Page URL
Help

Chapter 2. The Simplest Network > Flow Control - Pg. 68

68 MAKING THINGS TALK 8 Last but not least, add the scoring PFont myFont; int fontSize = 36; display. To do this, add two new global variables before the setup() method: 8 Then add two lines before the // create a font with the third font available to the system: PFont myFont = createFont(PFont.list()[2], fontSize); textFont(myFont); end of the setup() method to initialize the font: Finally, add two lines before the end of the draw() method to display the scores: Now you can play Monski pong! For added excitement, get a second pink monkey and put one sensor in each monkey so you can play with a friend. NOTE: You can find a complete listing for // print the scores: text(leftScore, fontSize, fontSize); text(rightScore, width-fontSize, fontSize);