|
01 packagepackage is used to name the directory or folder a class is in GBell;
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 Gbell
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 MakeBricks 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[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 bricks;
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 bricks=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) arrays40]brackets are typically used to declare, initialize and index (indicate which element of) arrays;
19 makeSprites();
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 intint is the type for whole numbers and it is short for integer index=this assignment operator makes the left side equal to the right side0;
25 intint is the type for whole numbers and it is short for integer numBricksHigh=this assignment operator makes the left side equal to the right side4;
26 doubledouble is the type for numbers that can contain decimal fractions startLocationY=this assignment operator makes the left side equal to the right side0.1;
27 doubledouble is the type for numbers that can contain decimal fractions endLocationY=this assignment operator makes the left side equal to the right side.25;
28 doubledouble is the type for numbers that can contain decimal fractions distanceHigh=this assignment operator makes the left side equal to the right sideendLocationY-startLocationY;
29 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 j=this assignment operator makes the left side equal to the right side0; j<numBricksHigh; j++this is the increment operator, which increases the variable by 1)
30 {open braces start code blocks and must be matched with a close brace
31 doubledouble is the type for numbers that can contain decimal fractions y=this assignment operator makes the left side equal to the right sidej*distanceHigh/(numBricksHigh-1)+adds two numbers together or concatenates Strings togetherstartLocationY;
32
33 intint is the type for whole numbers and it is short for integer numBricksAcross=this assignment operator makes the left side equal to the right side10;
34 doubledouble is the type for numbers that can contain decimal fractions startLocationX=this assignment operator makes the left side equal to the right side0.1;
35 doubledouble is the type for numbers that can contain decimal fractions endLocationX=this assignment operator makes the left side equal to the right side1-startLocationX;
36 doubledouble is the type for numbers that can contain decimal fractions distanceAcross=this assignment operator makes the left side equal to the right sideendLocationX-startLocationX;
37 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<numBricksAcross; i++this is the increment operator, which increases the variable by 1)
38 {open braces start code blocks and must be matched with a close brace
39 doubledouble is the type for numbers that can contain decimal fractions x=this assignment operator makes the left side equal to the right sidei*distanceAcross/(numBricksAcross-1)+adds two numbers together or concatenates Strings togetherstartLocationX;
40 bricks[brackets are typically used to declare, initialize and index (indicate which element of) arraysindex]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 RectangleSprite(2.4, 1.25);
41 bricks[brackets are typically used to declare, initialize and index (indicate which element of) arraysindex]brackets are typically used to declare, initialize and index (indicate which element of) arrays.setScale(.085);
42 bricks[brackets are typically used to declare, initialize and index (indicate which element of) arraysindex]brackets are typically used to declare, initialize and index (indicate which element of) arrays.setLocation(x, y);
43 bricks[brackets are typically used to declare, initialize and index (indicate which element of) arraysindex]brackets are typically used to declare, initialize and index (indicate which element of) arrays.setColor(Color.RED);
44 canvas.addSprite(bricks[brackets are typically used to declare, initialize and index (indicate which element of) arraysindex]brackets are typically used to declare, initialize and index (indicate which element of) arrays);
45 index++this is the increment operator, which increases the variable by 1;
46 }close braces end code blocks and must match an earlier open brace
47 }close braces end code blocks and must match an earlier open brace
48 }close braces end code blocks and must match an earlier open brace
49 }close braces end code blocks and must match an earlier open brace
|