|
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 DotsAcross 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 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value startGame()
12 {open braces start code blocks and must be matched with a close brace
13 makePlus();
14 }close braces end code blocks and must match an earlier open brace
15
16 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makePlus()
17 {open braces start code blocks and must be matched with a close brace
18 makeDotsAcross(0.1, 5);
19 makeDotsAcross(0.3, 5);
20 makeDotsAcross(0.5, 5);
21 makeDotsAcross(0.7, 5);
22 makeDotsAcross(0.9, 5);
23 //makeDotsAcross0();
24 //makeDotsAcross1();
25 //makeDotsAcross2();
26 //makeDotsDown();
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 makeDotsAcross(doubledouble is the type for numbers that can contain decimal fractions y, intint is the type for whole numbers and it is short for integer numDots)
30 {open braces start code blocks and must be matched with a close brace
31 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<numDots; i++this is the increment operator, which increases the variable by 1)
32 {open braces start code blocks and must be matched with a close brace
33 doubledouble is the type for numbers that can contain decimal fractions x=this assignment operator makes the left side equal to the right side(i+adds two numbers together or concatenates Strings together0.5)/numDots;
34 OvalSprite dot=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite(1, 1);
35 dot.setScale((1.0/numDots)/2);
36 dot.setLocation(x, y);
37 canvas.addSprite(dot);
38 }close braces end code blocks and must match an earlier open brace
39 }close braces end code blocks and must match an earlier open brace
40
41 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makeDotsAcross0()
42 {open braces start code blocks and must be matched with a close brace
43 intint is the type for whole numbers and it is short for integer numDots=this assignment operator makes the left side equal to the right side5;
44 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<numDots; i++this is the increment operator, which increases the variable by 1)
45 {open braces start code blocks and must be matched with a close brace
46 doubledouble is the type for numbers that can contain decimal fractions x=this assignment operator makes the left side equal to the right side(i+adds two numbers together or concatenates Strings together0.5)/numDots;
47 doubledouble is the type for numbers that can contain decimal fractions y=this assignment operator makes the left side equal to the right side0.4;
48 OvalSprite dot=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite(1, 1);
49 dot.setScale((1.0/numDots)/2);
50 dot.setLocation(x, y);
51 canvas.addSprite(dot);
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
54 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makeDotsAcross1()
55 {open braces start code blocks and must be matched with a close brace
56 intint is the type for whole numbers and it is short for integer numDots=this assignment operator makes the left side equal to the right side5;
57 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<numDots; i++this is the increment operator, which increases the variable by 1)
58 {open braces start code blocks and must be matched with a close brace
59 doubledouble is the type for numbers that can contain decimal fractions x=this assignment operator makes the left side equal to the right side(i+adds two numbers together or concatenates Strings together0.5)/numDots;
60 doubledouble is the type for numbers that can contain decimal fractions y=this assignment operator makes the left side equal to the right side0.5;
61 OvalSprite dot=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite(1, 1);
62 dot.setScale((1.0/numDots)/2);
63 dot.setLocation(x, y);
64 canvas.addSprite(dot);
65 }close braces end code blocks and must match an earlier open brace
66 }close braces end code blocks and must match an earlier open brace
67 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makeDotsAcross2()
68 {open braces start code blocks and must be matched with a close brace
69 intint is the type for whole numbers and it is short for integer numDots=this assignment operator makes the left side equal to the right side5;
70 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<numDots; i++this is the increment operator, which increases the variable by 1)
71 {open braces start code blocks and must be matched with a close brace
72 doubledouble is the type for numbers that can contain decimal fractions x=this assignment operator makes the left side equal to the right side(i+adds two numbers together or concatenates Strings together0.5)/numDots;
73 doubledouble is the type for numbers that can contain decimal fractions y=this assignment operator makes the left side equal to the right side0.6;
74 OvalSprite dot=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite(1, 1);
75 dot.setScale((1.0/numDots)/2);
76 dot.setLocation(x, y);
77 canvas.addSprite(dot);
78 }close braces end code blocks and must match an earlier open brace
79 }close braces end code blocks and must match an earlier open brace
80
81 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makeDotsDown()
82 {open braces start code blocks and must be matched with a close brace
83 intint is the type for whole numbers and it is short for integer numDots=this assignment operator makes the left side equal to the right side5;
84 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<numDots; i++this is the increment operator, which increases the variable by 1)
85 {open braces start code blocks and must be matched with a close brace
86 doubledouble is the type for numbers that can contain decimal fractions x=this assignment operator makes the left side equal to the right side0.5;
87 doubledouble is the type for numbers that can contain decimal fractions y=this assignment operator makes the left side equal to the right side(i+adds two numbers together or concatenates Strings together0.5)/numDots;
88 OvalSprite dot=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite(1, 1);
89 dot.setScale((1.0/numDots)/2);
90 dot.setLocation(x, y);
91 canvas.addSprite(dot);
92 }close braces end code blocks and must match an earlier open brace
93 }close braces end code blocks and must match an earlier open brace
94 }close braces end code blocks and must match an earlier open brace
|