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 DelayedInteraction 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 Sprite 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 OvalSprite(2, 1);
27 oval.setSize(0.75);
28 oval.setLocation(0.5, 0.5);
29 }close braces end code blocks and must match an earlier open brace
30
31 /**adds the sprites to the screen*/
32 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value addSprites()
33 {open braces start code blocks and must be matched with a close brace
34 addSprite(oval);
35 }close braces end code blocks and must match an earlier open brace
36
37 classclass is a group of fields and methods used for making objects DelayedResponse extendsextends means to customize or extend the functionality of a class TimedAction
38 {open braces start code blocks and must be matched with a close brace
39 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value act()
40 {open braces start code blocks and must be matched with a close brace
41 oval.setColor(getColor("white"));
42 }close braces end code blocks and must match an earlier open brace
43 }close braces end code blocks and must match an earlier open brace
44
45 /**handle input and game events*/
46 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value advance()
47 {open braces start code blocks and must be matched with a close brace
48 ifif executes the next statement only if the condition in parenthesis evaluates to true(getClick2D()!=this is the not equals operator which evaluates to true if both sides are differentnullnull is the value used to refer to a non-existant object)
49 {open braces start code blocks and must be matched with a close brace
50 schedule(newnew is used to create objects by calling the constructor DelayedResponse(), 2.5);
51 }close braces end code blocks and must match an earlier open brace
52 }close braces end code blocks and must match an earlier open brace
53 }close braces end code blocks and must match an earlier open brace
|
Download/View intro/DelayedInteraction.java