From ggc
|
01 packagepackage is used to name the directory or folder a class is in intro;
02
03 importimport means to make the classes and/or packages available in this program fang.*;
04 importimport means to make the classes and/or packages available in this program java.awt.*;
05 importimport means to make the classes and/or packages available in this program java.awt.geom.*;
06
07 /**
08 * All about my game.
09 * @authorthis is the Javadoc tag for documenting who created the source code My Name Here
10 */
11 publicpublic is used to indicate unrestricted access (any other class can have access) classclass is a group of fields and methods used for making objects SpinExample extendsextends means to customize or extend the functionality of a class Game
12 {open braces start code blocks and must be matched with a close brace
13 privateprivate is used to restrict access to the current class only PolygonSprite poly;
14
15 /**sets up the game*/
16 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setup()
17 {open braces start code blocks and must be matched with a close brace
18 poly=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(4);
19 poly.setSize(0.5);
20 poly.setLocation(0.5, 0.5);
21 addSprite(poly);
22
23 Spinner spinner;
24 spinner=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Spinner(0);
25 spinner.setRotationDegrees(45);
26
27 poly.addTransformer(spinner);
28 }close braces end code blocks and must match an earlier open brace
29
30 /**handle input and game events*/
31 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value advance()
32 {open braces start code blocks and must be matched with a close brace}close braces end code blocks and must match an earlier open brace
33 }close braces end code blocks and must match an earlier open brace
|
Download/View intro/SpinExample.java