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 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 GravityTrackerTest 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 /**an oval*/
15 privateprivate is used to restrict access to the current class only Sprite oval;
16 privateprivate is used to restrict access to the current class only GravityTracker tracker;
17 /**sets up the game*/
18 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value startGame()
19 {open braces start code blocks and must be matched with a close brace
20 makeSprites();
21 addSprites();
22 }close braces end code blocks and must match an earlier open brace
23
24 /**makes the sprites*/
25 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makeSprites()
26 {open braces start code blocks and must be matched with a close brace
27 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);
28 oval.setScale(0.75);
29 oval.setLocation(0.5, 0.5);
30 tracker=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor GravityTracker(0, -0.25);
31 oval.setTracker(tracker);
32 }close braces end code blocks and must match an earlier open brace
33
34 /**adds the sprites to the screen*/
35 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value addSprites()
36 {open braces start code blocks and must be matched with a close brace
37 canvas.addSprite(oval);
38 }close braces end code blocks and must match an earlier open brace
39
40 /**handle input and game events*/
41 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)
42 {open braces start code blocks and must be matched with a close brace
43 ifif executes the next statement only if the condition in parenthesis evaluates to true(oval.getLocation().y>0.8)
44 {open braces start code blocks and must be matched with a close brace
45 tracker.setVelocity(newnew is used to create objects by calling the constructor Point2D.Double(0, -0.25));
46 }close braces end code blocks and must match an earlier open brace
47 ifif executes the next statement only if the condition in parenthesis evaluates to true(getPlayer().getMouse().getClickLocation()!=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)
48 {open braces start code blocks and must be matched with a close brace
49 tracker.setGravityAmount(0.2);
50 }close braces end code blocks and must match an earlier open brace
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
|
Download/View jam/GravityTrackerTest.java