|
001 packagepackage is used to name the directory or folder a class is in Rohrer;
002 //start auto-imports
003 importimport means to make the classes and/or packages available in this program java.util.*;
004 //end auto-imports
005
006 importimport means to make the classes and/or packages available in this program java.lang.*;
007 importimport means to make the classes and/or packages available in this program fang.*;
008 importimport means to make the classes and/or packages available in this program java.awt.*;
009 importimport means to make the classes and/or packages available in this program java.awt.geom.*;
010
011 /**
012 * Assignment 8: Lights Out.
013 * @authorthis is the Javadoc tag for documenting who created the source code Kevin Rohrer
014 * with permission from Frank Anderson I used his base code and made my improvments
015 */
016 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 Lights_Out_Assignment_8 extendsextends means to customize or extend the functionality of a class Game
017 {open braces start code blocks and must be matched with a close brace
018 /** shapes used to create and then add to the grid and lights arrays*/
019 privateprivate is used to restrict access to the current class only OvalSprite light;
020 privateprivate is used to restrict access to the current class only RectangleSprite box;
021 /**screen outline enabling the display of text around the border*/
022 publicpublic is used to indicate unrestricted access (any other class can have access) OutlineSprite screenOutline;
023 privateprivate is used to restrict access to the current class only intint is the type for whole numbers and it is short for integer row =this assignment operator makes the left side equal to the right side 0;
024 privateprivate is used to restrict access to the current class only intint is the type for whole numbers and it is short for integer column =this assignment operator makes the left side equal to the right side 0;
025 /** the size of the grid both in the horizontal and vertical*/
026 privateprivate is used to restrict access to the current class only intint is the type for whole numbers and it is short for integer gridSize =this assignment operator makes the left side equal to the right side 7;
027 /** the arrays used to create the correct amount of boxes and lights*/
028 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[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 lights =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor Sprite[brackets are typically used to declare, initialize and index (indicate which element of) arraysgridSize]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) arraysgridSize]brackets are typically used to declare, initialize and index (indicate which element of) arrays;
029 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[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 grid =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor Sprite[brackets are typically used to declare, initialize and index (indicate which element of) arraysgridSize]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) arraysgridSize]brackets are typically used to declare, initialize and index (indicate which element of) arrays;
030 /** tenXRowPlusColumn is an integer equal in value to 10 times the row position of a light plus the column position. */
031 privateprivate is used to restrict access to the current class only intint is the type for whole numbers and it is short for integer tenXRowPlusColumn =this assignment operator makes the left side equal to the right side 0;
032 /** lightRow is the horizontal row of a clicked light. */
033 privateprivate is used to restrict access to the current class only intint is the type for whole numbers and it is short for integer lightRow =this assignment operator makes the left side equal to the right side 0;
034 /** lightColumn is the vertical column of a clicked light. */
035 privateprivate is used to restrict access to the current class only intint is the type for whole numbers and it is short for integer lightColumn =this assignment operator makes the left side equal to the right side 0;
036 /** the arraylist that shows how to finish the puzzle when activated*/
037 ArrayList<Integer> hints =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor ArrayList<Integer>();
038 /** creates the clicks remaining text and helpscreen notification text*/
039 privateprivate is used to restrict access to the current class only StringSprite clicksRemaining, help;
040 /**ammount of clicks until auto loose*/
041 intint is the type for whole numbers and it is short for integer clicks =this assignment operator makes the left side equal to the right side 20;
042
043 /**sets up the game*/
044 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setup()
045 {open braces start code blocks and must be matched with a close brace
046 makeGridBoxes();
047 createLights();
048 addRandomLights();
049 addScreenOutline();
050 helpScreen();
051 textDisplay();
052 }close braces end code blocks and must match an earlier open brace
053
054 /**handle input and game events*/
055 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value advance()
056 {open braces start code blocks and must be matched with a close brace
057 changeWhenClicked();
058 addHints();
059 }close braces end code blocks and must match an earlier open brace
060
061 /** gets which light has been clicked and returns the value */
062 privateprivate is used to restrict access to the current class only intint is the type for whole numbers and it is short for integer getLightClicked()
063 {open braces start code blocks and must be matched with a close brace
064 intint is the type for whole numbers and it is short for integer position =this assignment operator makes the left side equal to the right side 0;
065 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 side1;i<=this evaluates to true if the left side is not more than the right side5;i++this is the increment operator, which increases the variable by 1)
066 {open braces start code blocks and must be matched with a close brace
067 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 side 1; j <=this evaluates to true if the left side is not more than the right side5; j++this is the increment operator, which increases the variable by 1)
068 {open braces start code blocks and must be matched with a close brace
069 ifif executes the next statement only if the condition in parenthesis evaluates to true(getClick2D().intersects(lights[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[brackets are typically used to declare, initialize and index (indicate which element of) arraysj]brackets are typically used to declare, initialize and index (indicate which element of) arrays))
070 {open braces start code blocks and must be matched with a close brace
071 position =this assignment operator makes the left side equal to the right side 10*i +adds two numbers together or concatenates Strings together j;
072 clicks--this is the decrement operator, which decreases the variable by 1;
073 clicksRemaining.setText("Clicks Remaining: " +adds two numbers together or concatenates Strings together clicks);
074 hints.add(position);
075 grid[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[brackets are typically used to declare, initialize and index (indicate which element of) arraysj]brackets are typically used to declare, initialize and index (indicate which element of) arrays.setColor(getColor("green"));
076
077
078 /** returnreturn means to provide the result of the method and/or cease execution of the method immediately position is used to determine the location of the light clicked.*/
079 returnreturn means to provide the result of the method and/or cease execution of the method immediately position;
080 }close braces end code blocks and must match an earlier open brace
081 }close braces end code blocks and must match an earlier open brace
082 }close braces end code blocks and must match an earlier open brace
083 /** @returnnull 0 is returned ifif executes the next statement only if the condition in parenthesis evaluates to true no click of the mouse is detected. */
084 returnreturn means to provide the result of the method and/or cease execution of the method immediately(0);
085 }close braces end code blocks and must match an earlier open brace
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103 /** when the (h) key is pressed all the preveously clicked gris spaces are highlighted*/
104 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value addHints()
105 {open braces start code blocks and must be matched with a close brace
106 ifif executes the next statement only if the condition in parenthesis evaluates to true(getKeyPressed()==this is the comparison operator which evaluates to true if both sides are the same'h')
107 {open braces start code blocks and must be matched with a close brace
108 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 hint: hints)
109 {open braces start code blocks and must be matched with a close brace
110 intint is the type for whole numbers and it is short for integer hintRow =this assignment operator makes the left side equal to the right side hint/10;
111 intint is the type for whole numbers and it is short for integer hintColumn =this assignment operator makes the left side equal to the right side hint%this divides the left side by the right side and evaluates to the remainder10;
112 grid[brackets are typically used to declare, initialize and index (indicate which element of) arrayshintRow]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) arrayshintColumn]brackets are typically used to declare, initialize and index (indicate which element of) arrays.setColor(getColor("purple"));
113 }close braces end code blocks and must match an earlier open brace
114 }close braces end code blocks and must match an earlier open brace
115 }close braces end code blocks and must match an earlier open brace
116 /**Makes random clicks to create the puzzle but still have it solvable */
117 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value addRandomLights()
118 {open braces start code blocks and must be matched with a close brace
119 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 side 1;i<=this evaluates to true if the left side is not more than the right side5;i++this is the increment operator, which increases the variable by 1)
120 {open braces start code blocks and must be matched with a close brace
121 row =this assignment operator makes the left side equal to the right side 1+adds two numbers together or concatenates Strings together(intint is the type for whole numbers and it is short for integer)(4*Math.random());
122 column=this assignment operator makes the left side equal to the right side1+adds two numbers together or concatenates Strings together(intint is the type for whole numbers and it is short for integer)(4*Math.random());
123 changeLight(row,column);
124 changeLightsInCross(row,column);
125 hints.add(row*10+adds two numbers together or concatenates Strings togethercolumn);
126 }close braces end code blocks and must match an earlier open brace
127 }close braces end code blocks and must match an earlier open brace
128 /** changes the light that is clicked when the user clickes a light*/
129 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value changeWhenClicked()
130 {open braces start code blocks and must be matched with a close brace
131 ifif executes the next statement only if the condition in parenthesis evaluates to true(getClick2D() !=this is the not equals operator which evaluates to true if both sides are different nullnull is the value used to refer to a non-existant object &this performs a bit-wise and (not the same as boolean and which is &&)&this performs a bit-wise and (not the same as boolean and which is &&) clicks > 0)
132 {open braces start code blocks and must be matched with a close brace
133 /** Get the row and columm number of the light clicked */
134 tenXRowPlusColumn=this assignment operator makes the left side equal to the right sidegetLightClicked();
135 ifif executes the next statement only if the condition in parenthesis evaluates to true(tenXRowPlusColumn !=this is the not equals operator which evaluates to true if both sides are different 0)
136 {open braces start code blocks and must be matched with a close brace
137 /** Determines the row number of the light clicked by intint is the type for whole numbers and it is short for integer devision */
138 lightRow =this assignment operator makes the left side equal to the right side tenXRowPlusColumn/10;
139 /** Determines by column number of the light clicked by the remainder */
140 lightColumn =this assignment operator makes the left side equal to the right side tenXRowPlusColumn%this divides the left side by the right side and evaluates to the remainder10;
141 /** Change the status of the light that was clicked */
142 changeLight(lightRow, lightColumn);
143 /** Change the status of the lights in the cross about the clicked light */
144 changeLightsInCross(lightRow, lightColumn);
145 }close braces end code blocks and must match an earlier open brace
146 }close braces end code blocks and must match an earlier open brace
147 }close braces end code blocks and must match an earlier open brace
148 /**makes the squares in the backround to create the basic grid */
149 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makeGridBoxes()
150 {open braces start code blocks and must be matched with a close brace
151 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<gridSize;i++this is the increment operator, which increases the variable by 1)
152 {open braces start code blocks and must be matched with a close brace
153 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<gridSize;j++this is the increment operator, which increases the variable by 1)
154 {open braces start code blocks and must be matched with a close brace
155 box=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor RectangleSprite(1, 1);
156 grid[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[brackets are typically used to declare, initialize and index (indicate which element of) arraysj]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 side box;
157 box.setSize(.9/gridSize);
158 doubledouble is the type for numbers that can contain decimal fractions x =this assignment operator makes the left side equal to the right side 0.5/gridSize+adds two numbers together or concatenates Strings together1.0/gridSize*i;
159 doubledouble is the type for numbers that can contain decimal fractions y =this assignment operator makes the left side equal to the right side 0.5/gridSize+adds two numbers together or concatenates Strings together1.0/gridSize*j;
160 box.setLocation(x, y);
161 box.setColor(getColor("green"));
162 box.setVisible(truetrue is the boolean value that is the opposite of false);
163 addSprite(box);
164 }close braces end code blocks and must match an earlier open brace
165 }close braces end code blocks and must match an earlier open brace
166 }close braces end code blocks and must match an earlier open brace
167 /** Creates 49 circles in a 7x7 matrix with columns 0 and 6 off the screen.
168 * Rows 0 and 6 are above and below the playing field */
169 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value createLights()
170 {open braces start code blocks and must be matched with a close brace
171 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<gridSize;i++this is the increment operator, which increases the variable by 1)
172 {open braces start code blocks and must be matched with a close brace
173 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<gridSize;j++this is the increment operator, which increases the variable by 1)
174 {open braces start code blocks and must be matched with a close brace
175 light =this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite(1, 1);
176 lights[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[brackets are typically used to declare, initialize and index (indicate which element of) arraysj]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 side light;
177 light.setSize(.85/gridSize);
178 doubledouble is the type for numbers that can contain decimal fractions x =this assignment operator makes the left side equal to the right side 0.5/gridSize+adds two numbers together or concatenates Strings together1.0/gridSize*i;
179 doubledouble is the type for numbers that can contain decimal fractions y =this assignment operator makes the left side equal to the right side 0.5/gridSize+adds two numbers together or concatenates Strings together1.0/gridSize*j;
180 light.setLocation(x, y);
181 light.setColor(getColor("orange red"));
182 light.setVisible(falsefalse is a value for the boolean type and means not true);
183 addSprite(light);
184 }close braces end code blocks and must match an earlier open brace
185 }close braces end code blocks and must match an earlier open brace
186 }close braces end code blocks and must match an earlier open brace
187 /** creates a outline sprite to hide the outer grid bricks and corosponding lights*/
188 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value addScreenOutline()
189 {open braces start code blocks and must be matched with a close brace
190 PolygonSprite screen =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor PolygonSprite(.0,.0,1,.0,1,1,.0,1);
191 screenOutline =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor OutlineSprite(screen);
192 screenOutline.setSize(1.1);
193 screenOutline.setLineThickness(0.205);
194 screenOutline.setLocation(0.5, 0.5);
195 screenOutline.setColor(getColor("black"));
196 addSprite(screenOutline);
197 }close braces end code blocks and must match an earlier open brace
198 /** changes the status of the clicked light depending on preveous status */
199 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value changeLight(intint is the type for whole numbers and it is short for integer row, intint is the type for whole numbers and it is short for integer column)
200 {open braces start code blocks and must be matched with a close brace
201 ifif executes the next statement only if the condition in parenthesis evaluates to true(lights[brackets are typically used to declare, initialize and index (indicate which element of) arraysrow]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) arrayscolumn]brackets are typically used to declare, initialize and index (indicate which element of) arrays.isVisible())
202 {open braces start code blocks and must be matched with a close brace
203 lights[brackets are typically used to declare, initialize and index (indicate which element of) arraysrow]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) arrayscolumn]brackets are typically used to declare, initialize and index (indicate which element of) arrays.setVisible(falsefalse is a value for the boolean type and means not true);
204 }close braces end code blocks and must match an earlier open brace
205 elseelse is what happens when the if condition is false
206 {open braces start code blocks and must be matched with a close brace
207 lights[brackets are typically used to declare, initialize and index (indicate which element of) arraysrow]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) arrayscolumn]brackets are typically used to declare, initialize and index (indicate which element of) arrays.setVisible(truetrue is the boolean value that is the opposite of false);
208 }close braces end code blocks and must match an earlier open brace
209 }close braces end code blocks and must match an earlier open brace
210 /** changes the light above and below and to ither side of the clicked light */
211 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value changeLightsInCross(intint is the type for whole numbers and it is short for integer row, intint is the type for whole numbers and it is short for integer column)
212 {open braces start code blocks and must be matched with a close brace
213 ifif executes the next statement only if the condition in parenthesis evaluates to true(lights[brackets are typically used to declare, initialize and index (indicate which element of) arraysrow+adds two numbers together or concatenates Strings together1]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) arrayscolumn]brackets are typically used to declare, initialize and index (indicate which element of) arrays.isVisible())
214 lights[brackets are typically used to declare, initialize and index (indicate which element of) arraysrow+adds two numbers together or concatenates Strings together1]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) arrayscolumn]brackets are typically used to declare, initialize and index (indicate which element of) arrays.setVisible(falsefalse is a value for the boolean type and means not true);
215 elseelse is what happens when the if condition is false
216 lights[brackets are typically used to declare, initialize and index (indicate which element of) arraysrow+adds two numbers together or concatenates Strings together1]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) arrayscolumn]brackets are typically used to declare, initialize and index (indicate which element of) arrays.setVisible(truetrue is the boolean value that is the opposite of false);
217
218 ifif executes the next statement only if the condition in parenthesis evaluates to true(lights[brackets are typically used to declare, initialize and index (indicate which element of) arraysrow-1]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) arrayscolumn]brackets are typically used to declare, initialize and index (indicate which element of) arrays.isVisible())
219 lights[brackets are typically used to declare, initialize and index (indicate which element of) arraysrow-1]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) arrayscolumn]brackets are typically used to declare, initialize and index (indicate which element of) arrays.setVisible(falsefalse is a value for the boolean type and means not true);
220 elseelse is what happens when the if condition is false
221 lights[brackets are typically used to declare, initialize and index (indicate which element of) arraysrow-1]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) arrayscolumn]brackets are typically used to declare, initialize and index (indicate which element of) arrays.setVisible(truetrue is the boolean value that is the opposite of false);
222
223 ifif executes the next statement only if the condition in parenthesis evaluates to true(lights[brackets are typically used to declare, initialize and index (indicate which element of) arraysrow]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) arrayscolumn+adds two numbers together or concatenates Strings together1]brackets are typically used to declare, initialize and index (indicate which element of) arrays.isVisible())
224 lights[brackets are typically used to declare, initialize and index (indicate which element of) arraysrow]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) arrayscolumn+adds two numbers together or concatenates Strings together1]brackets are typically used to declare, initialize and index (indicate which element of) arrays.setVisible(falsefalse is a value for the boolean type and means not true);
225 elseelse is what happens when the if condition is false
226 lights[brackets are typically used to declare, initialize and index (indicate which element of) arraysrow]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) arrayscolumn+adds two numbers together or concatenates Strings together1]brackets are typically used to declare, initialize and index (indicate which element of) arrays.setVisible(truetrue is the boolean value that is the opposite of false);
227
228 ifif executes the next statement only if the condition in parenthesis evaluates to true(lights[brackets are typically used to declare, initialize and index (indicate which element of) arraysrow]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) arrayscolumn-1]brackets are typically used to declare, initialize and index (indicate which element of) arrays.isVisible())
229 lights[brackets are typically used to declare, initialize and index (indicate which element of) arraysrow]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) arrayscolumn-1]brackets are typically used to declare, initialize and index (indicate which element of) arrays.setVisible(falsefalse is a value for the boolean type and means not true);
230 elseelse is what happens when the if condition is false
231 lights[brackets are typically used to declare, initialize and index (indicate which element of) arraysrow]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) arrayscolumn-1]brackets are typically used to declare, initialize and index (indicate which element of) arrays.setVisible(truetrue is the boolean value that is the opposite of false);
232 }close braces end code blocks and must match an earlier open brace
233 /** creates the text displaying the remaining clicks and the text informing of help screen*/
234 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value textDisplay()
235 {open braces start code blocks and must be matched with a close brace
236 clicksRemaining =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor StringSprite("Clicks Remaining: " +adds two numbers together or concatenates Strings together clicks);
237 clicksRemaining.leftJustify();
238 clicksRemaining.setWidth(.7);
239 clicksRemaining.setLocation(.01, .055);
240 clicksRemaining.setColor(getColor("White"));
241 addSprite(clicksRemaining);
242
243 help =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor StringSprite("click help for further instructions");
244 help.leftJustify();
245 help.setWidth(.5);
246 help.setLocation(.01, .975);
247 help.setColor(getColor("white"));
248 addSprite(help);
249 }close braces end code blocks and must match an earlier open brace
250 /** creates the text to go into the help screen*/
251 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value helpScreen()
252 {open braces start code blocks and must be matched with a close brace
253 String helpText=this assignment operator makes the left side equal to the right side
254 "To solve the puzzle you must turn all the lights off<br>"+adds two numbers together or concatenates Strings together
255 "you have a total of 20 clicks to finish the puzzle or you lose<br>"+adds two numbers together or concatenates Strings together
256 "Press the (H) key to highlight the presed lights in an attempt to help solve the puzzle<br>"+adds two numbers together or concatenates Strings together
257 "Enjoy.";
258 setHelpText(helpText);
259 }close braces end code blocks and must match an earlier open brace
260 }close braces end code blocks and must match an earlier open brace
|