From ggc
|
01 packagepackage is used to name the directory or folder a class is in jam;
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 StringSpriteExample 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 /**an oval*/
14 privateprivate is used to restrict access to the current class only StringSprite oval;
15
16 /**sets up the game*/
17 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setup()
18 {open braces start code blocks and must be matched with a close brace
19 makeSprites();
20 addSprites();
21 }close braces end code blocks and must match an earlier open brace
22
23 /**makes the sprites*/
24 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makeSprites()
25 {open braces start code blocks and must be matched with a close brace
26 oval=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Christopher James Jenkins");
27 oval.setWidth(1);
28 oval.rightJustify();
29 oval.bottomJustify();
30 oval.setLocation(1, 1);
31
32 StringSprite other;
33 other=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("JJ");
34 other.setHeight(0.1);
35 other.rightJustify();
36 other.topJustify();
37 other.setLocation(1, 0);
38 addSprite(other);
39 }close braces end code blocks and must match an earlier open brace
40
41 /**adds the sprites to the screen*/
42 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value addSprites()
43 {open braces start code blocks and must be matched with a close brace
44 addSprite(oval);
45 }close braces end code blocks and must match an earlier open brace
46
47 /**handle input and game events*/
48 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value advance()
49 {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
50 }close braces end code blocks and must match an earlier open brace
|
Download/View jam/StringSpriteExample.java