From ggc
|
01 packagepackage is used to name the directory or folder a class is in Example;
02
03 importimport means to make the classes and/or packages available in this program wiki.Wiki;
04 importimport means to make the classes and/or packages available in this program fang.*;
05 importimport means to make the classes and/or packages available in this program java.awt.*;
06 importimport means to make the classes and/or packages available in this program java.awt.geom.*;
07
08 /**
09 * All about my game here.
10 * @authorthis is the Javadoc tag for documenting who created the source code Jam Jenkins
11 */
12 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 Deal1 extendsextends means to customize or extend the functionality of a class GameLoop
13 {open braces start code blocks and must be matched with a close brace
14 privateprivate is used to restrict access to the current class only Sprite box1;
15
16 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value startGame()
17 {open braces start code blocks and must be matched with a close brace
18 makeSprites();
19 addSprites();
20 }close braces end code blocks and must match an earlier open brace
21
22 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makeSprites()
23 {open braces start code blocks and must be matched with a close brace
24 box1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor RectangleSprite(1, 1);
25 box1.setScale(0.25);
26 box1.setLocation(0.5, 0.5);
27 }close braces end code blocks and must match an earlier open brace
28
29 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value addSprites()
30 {open braces start code blocks and must be matched with a close brace
31 canvas.addSprite(box1);
32 }close braces end code blocks and must match an earlier open brace
33
34 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value advanceFrame(doubledouble is the type for numbers that can contain decimal fractions timePassed)
35 {open braces start code blocks and must be matched with a close brace
36 Point2D.Double click=this assignment operator makes the left side equal to the right sidegetPlayer().getMouse().getClickLocation();
37 //did they click at all
38 ifif executes the next statement only if the condition in parenthesis evaluates to true(click!=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)
39 {open braces start code blocks and must be matched with a close brace
40 ifif executes the next statement only if the condition in parenthesis evaluates to true(box1.intersects(click))
41 {open braces start code blocks and must be matched with a close brace
42 canvas.removeSprite(box1);
43 }close braces end code blocks and must match an earlier open brace
44 }close braces end code blocks and must match an earlier open brace
45 }close braces end code blocks and must match an earlier open brace
46 }close braces end code blocks and must match an earlier open brace
|
Download/View Example/Deal1.java