|
01 importimport means to make the classes and/or packages available in this program fang.*;
02 importimport means to make the classes and/or packages available in this program java.awt.*;
03 importimport means to make the classes and/or packages available in this program java.awt.geom.*;
04
05 /**
06 * All about my game here.
07 * @authorthis is the Javadoc tag for documenting who created the source code Jam Jenkins
08 */
09 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 LotsOfShapes extendsextends means to customize or extend the functionality of a class GameLoop
10 {open braces start code blocks and must be matched with a close brace
11 /**an oval*/
12 privateprivate is used to restrict access to the current class only Sprite[brackets are typically used to declare, initialize and index (indicate which element of) arrays]brackets are typically used to declare, initialize and index (indicate which element of) arrays oval;
13
14 /**sets up the game*/
15 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value startGame()
16 {open braces start code blocks and must be matched with a close brace
17 oval=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Sprite[brackets are typically used to declare, initialize and index (indicate which element of) arrays100]brackets are typically used to declare, initialize and index (indicate which element of) arrays;
18 makeSprites();
19 addSprites();
20 }close braces end code blocks and must match an earlier open brace
21
22 /**makes the sprites*/
23 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makeSprites()
24 {open braces start code blocks and must be matched with a close brace
25 forfor is a looping structure for repeatedly executing a block of code(intint is the type for whole numbers and it is short for integer i=this assignment operator makes the left side equal to the right side0; i<oval.length; i++this is the increment operator, which increases the variable by 1)
26 {open braces start code blocks and must be matched with a close brace
27 oval[brackets are typically used to declare, initialize and index (indicate which element of) arraysi]brackets are typically used to declare, initialize and index (indicate which element of) arrays=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(random.nextInt(5)+adds two numbers together or concatenates Strings together3);
28 oval[brackets are typically used to declare, initialize and index (indicate which element of) arraysi]brackets are typically used to declare, initialize and index (indicate which element of) arrays.setScale(random.nextDouble());
29 oval[brackets are typically used to declare, initialize and index (indicate which element of) arraysi]brackets are typically used to declare, initialize and index (indicate which element of) arrays.setLocation(random.nextDouble(), random.nextDouble());
30 Color color=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Color(random.nextFloat(), random.nextFloat(), random.nextFloat());
31 oval[brackets are typically used to declare, initialize and index (indicate which element of) arraysi]brackets are typically used to declare, initialize and index (indicate which element of) arrays.setColor(color);
32 }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
34
35 /**adds the sprites to the screen*/
36 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value addSprites()
37 {open braces start code blocks and must be matched with a close brace
38 forfor is a looping structure for repeatedly executing a block of code(intint is the type for whole numbers and it is short for integer i=this assignment operator makes the left side equal to the right side0; i<oval.length; i++this is the increment operator, which increases the variable by 1)
39 {open braces start code blocks and must be matched with a close brace
40 canvas.addSprite(oval);
41 }close braces end code blocks and must match an earlier open brace
42 }close braces end code blocks and must match an earlier open brace
43
44 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)
45 {open braces start code blocks and must be matched with a close brace
46 Point2D.Double click=this assignment operator makes the left side equal to the right sidegetPlayer().getMouse().getClickLocation();
47 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)
48 {open braces start code blocks and must be matched with a close brace
49 forfor is a looping structure for repeatedly executing a block of code(intint is the type for whole numbers and it is short for integer i=this assignment operator makes the left side equal to the right side0; i<oval.length; i++this is the increment operator, which increases the variable by 1)
50 {open braces start code blocks and must be matched with a close brace
51 ifif executes the next statement only if the condition in parenthesis evaluates to true(oval[brackets are typically used to declare, initialize and index (indicate which element of) arraysi]brackets are typically used to declare, initialize and index (indicate which element of) arrays.intersects(click))
52 {open braces start code blocks and must be matched with a close brace
53 canvas.removeSprite(oval[brackets are typically used to declare, initialize and index (indicate which element of) arraysi]brackets are typically used to declare, initialize and index (indicate which element of) arrays);
54 }close braces end code blocks and must match an earlier open brace
55 }close braces end code blocks and must match an earlier open brace
56 }close braces end code blocks and must match an earlier open brace
57 }close braces end code blocks and must match an earlier open brace
58
59 }close braces end code blocks and must match an earlier open brace
|