Java Reference
In-Depth Information
Figure 2-12. The ZenPong game in action
4.
if the ball hits the left or right wall, one of your hands has lost the game. notice that the game
resets, looking again like the screenshot in figure 2-11 .
Now that you've experienced the behavior of the ZenPong program, let's review the code behind it.
Understanding the ZenPong Program
Examine the code for the ZenPong program in Listing 2-8, before we highlight some concepts demonstrated within.
Listing 2-8. ZenPongMain.java
package projavafx.zenpong.ui;
...imports omitted...
public class ZenPongMain extends Application {
/**
* The center points of the moving ball
*/
DoubleProperty centerX = new SimpleDoubleProperty();
DoubleProperty centerY = new SimpleDoubleProperty();
 
Search WWH ::




Custom Search