|
001 packagepackage is used to name the directory or folder a class is in Joseph_Danielle;
002
003 importimport means to make the classes and/or packages available in this program fang.*;
004 importimport means to make the classes and/or packages available in this program java.awt.*;
005 importimport means to make the classes and/or packages available in this program java.awt.geom.*;
006 importimport means to make the classes and/or packages available in this program java.util.Random;
007
008 /**
009 * All about my game.
010 * @authorthis is the Javadoc tag for documenting who created the source code Danielle Kyser and Joseph Argumedo
011 * We used mcclarty/Monty_Hall forfor is a looping structure for repeatedly executing a block of code helping us figure out the problems that we had with publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value advance()
012 and showed us how everything can be organized.
013 * We used intro/TooManyBraces to figure out how to click on a door and let it disappear
014 * We used Min/letsdeal to figure out how the ifif executes the next statement only if the condition in parenthesis evaluates to true statements should look like.
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 Deal 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 privateprivate is used to restrict access to the current class only ImageSprite left;
019 privateprivate is used to restrict access to the current class only ImageSprite center;
020 privateprivate is used to restrict access to the current class only ImageSprite right;
021 privateprivate is used to restrict access to the current class only Sprite one_left;
022 privateprivate is used to restrict access to the current class only Sprite two_center;
023 privateprivate is used to restrict access to the current class only Sprite three_right;
024 privateprivate is used to restrict access to the current class only ImageSprite money;
025 privateprivate is used to restrict access to the current class only ImageSprite penny;
026 privateprivate is used to restrict access to the current class only ImageSprite penny2;
027 privateprivate is used to restrict access to the current class only StringSprite title;
028 privateprivate is used to restrict access to the current class only StringSprite demand;
029 privateprivate is used to restrict access to the current class only StringSprite decision;
030 privateprivate is used to restrict access to the current class only StringSprite win;
031 privateprivate is used to restrict access to the current class only StringSprite lose;
032 privateprivate is used to restrict access to the current class only intint is the type for whole numbers and it is short for integer numClicks=this assignment operator makes the left side equal to the right side0;
033 privateprivate is used to restrict access to the current class only Sound clap=this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor Sound ("Clapping.wav");
034 //private int z;
035 intint is the type for whole numbers and it is short for integer z=this assignment operator makes the left side equal to the right siderandom.nextInt(3)+adds two numbers together or concatenates Strings together1;
036 privateprivate is used to restrict access to the current class only StringSprite restart;
037
038
039 /**sets up the game*/
040 /** Where images and phrases are created to show on the screen*/
041 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setup()
042 {open braces start code blocks and must be matched with a close brace
043 clap();
044
045 //numClicks=0;
046 // z=random.nextInt(3)+1;
047
048 penny=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite ("Penny.jpg");
049 penny.setScale(0.15);
050 //penny.setLocation(0.5,0.5);
051 addSprite(penny);
052
053 penny2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite ("Penny.jpg");
054 penny2.setSize(0.15);
055 //penny2.setLocation(0.85,0.5);
056 addSprite(penny2);
057
058 money=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite ("MONEYY.jpg");
059 money.setScale(0.20);
060 //money.setLocation(0.15,0.5);
061 addSprite(money);
062
063 left=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite ("gameDoor.JPG");
064 left.setScale(0.45);
065 left.setLocation (0.15, 0.5);
066 addSprite(left);
067
068 center=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite ("gameDoor.JPG");
069 center.setScale(0.45);
070 center.setLocation (0.5, 0.5);
071 addSprite(center);
072
073 right=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite ("gameDoor.JPG");
074 right.setScale(0.45);
075 right.setLocation (0.85, 0.5);
076 addSprite(right);
077
078 one_left=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("1");
079 one_left.setSize(0.06);
080 one_left.setLocation (0.15,0.5);
081 one_left.setColor(Palette.getColor("White"));
082 addSprite(one_left);
083
084 two_center=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("2");
085 two_center.setScale(0.06);
086 two_center.setLocation (0.5,0.5);
087 two_center.setColor(Palette.getColor("White"));
088 addSprite(two_center);
089
090 three_right=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("3");
091 three_right.setScale(0.06);
092 three_right.setLocation (0.85,0.5);
093 three_right.setColor(Palette.getColor("White"));
094 addSprite(three_right);
095
096 title=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Lets Make a Deal");
097 title.setSize(0.8);
098 title.setLocation (0.5,0.1);
099 title.setColor(Color.BLUE);
100 title.topJustify();
101 addSprite(title);
102
103 lose=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("BETTER LUCK NEXT TIME");
104 lose.setSize(0.9);
105 lose.setScale(0.9);
106 lose.setLocation(0.5,0.3);
107 lose.setColor(Color.RED);
108 addSprite(lose);
109 lose.setVisible(falsefalse is a value for the boolean type and means not true);
110
111 win=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("YOU WIN");
112 win.setScale (0.8);
113 win.setLocation(0.5,0.3);
114 win.setColor(Color.ORANGE);
115 addSprite(win);
116 win.setVisible(falsefalse is a value for the boolean type and means not true);
117
118 demand=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("PICK A DOOR AND WIN A PRIZE");
119 demand. setScale(0.95);
120 demand.setLocation (0.5,0.9);
121 demand. setColor(Color.YELLOW);
122 demand.bottomJustify();
123 addSprite(demand);
124
125 decision=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Press Q to Stay or W to Switch");
126 decision.setScale(0.8);
127 decision.setLocation (0.5,0.1);
128 decision.setColor(Color.MAGENTA);
129 addSprite(decision);
130 decision.setVisible(falsefalse is a value for the boolean type and means not true);
131
132 restart =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor StringSprite("Press R to TRY AGIAN!!");
133 restart.setScale(.9);
134 restart.setLocation(.5, .8);
135 restart.setVisible(falsefalse is a value for the boolean type and means not true);
136
137 options();
138 }close braces end code blocks and must match an earlier open brace
139
140 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value clap()
141 {open braces start code blocks and must be matched with a close brace}close braces end code blocks and must match an earlier open brace
142
143 /**handle input and game events*/
144 //calling the methods
145 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value advance()
146 {open braces start code blocks and must be matched with a close brace
147 left();
148 //one_left();
149 center();
150 //two_center();
151 right();
152 //three_right();
153 }close braces end code blocks and must match an earlier open brace
154 //randomizing the money and the penny options when one plays
155 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value options()
156 {open braces start code blocks and must be matched with a close brace
157 z=this assignment operator makes the left side equal to the right siderandom.nextInt(3)+adds two numbers together or concatenates Strings together1;
158
159 ifif executes the next statement only if the condition in parenthesis evaluates to true(z==this is the comparison operator which evaluates to true if both sides are the same1)
160 {open braces start code blocks and must be matched with a close brace
161 money.setLocation(0.15,0.5);
162 penny2.setLocation(0.5,0.5);
163 penny.setLocation(0.85,0.5);
164 }close braces end code blocks and must match an earlier open brace
165 ifif executes the next statement only if the condition in parenthesis evaluates to true(z==this is the comparison operator which evaluates to true if both sides are the same2)
166 {open braces start code blocks and must be matched with a close brace
167 money.setLocation(0.5, 0.5);
168 penny2.setLocation(0.85,0.5);
169 penny.setLocation(0.15,0.5);
170 }close braces end code blocks and must match an earlier open brace
171 ifif executes the next statement only if the condition in parenthesis evaluates to true(z==this is the comparison operator which evaluates to true if both sides are the same3)
172 {open braces start code blocks and must be matched with a close brace
173 money.setLocation(0.85,0.5);
174 penny2.setLocation(0.15,0.5);
175 penny.setLocation(0.5,0.5);
176 }close braces end code blocks and must match an earlier open brace
177 }close braces end code blocks and must match an earlier open brace
178
179 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value left()
180 {open braces start code blocks and must be matched with a close brace
181 /**THE OPTIONS OF WHAT HAPPENS WHEN ONE CLICKS ON A DOOR AND PRESSES Q OR W. THIS CASE THE LEFT DOOR*/
182 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 differentnullnull 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 &&) left.intersects(getClick2D()))
183 //REMINDER z=random.nextInt(3)+1;
184 {open braces start code blocks and must be matched with a close brace
185 numClicks++this is the increment operator, which increases the variable by 1;
186 }close braces end code blocks and must match an earlier open brace
187 ifif executes the next statement only if the condition in parenthesis evaluates to true(numClicks==this is the comparison operator which evaluates to true if both sides are the same1)
188 {open braces start code blocks and must be matched with a close brace
189 ifif executes the next statement only if the condition in parenthesis evaluates to true(z==this is the comparison operator which evaluates to true if both sides are the same1)
190 {open braces start code blocks and must be matched with a close brace
191 right.setVisible(falsefalse is a value for the boolean type and means not true);
192 three_right.setVisible(falsefalse is a value for the boolean type and means not true);
193 demand.setVisible(falsefalse is a value for the boolean type and means not true);
194 decision.setVisible(truetrue is the boolean value that is the opposite of false);
195 title.setVisible(falsefalse is a value for the boolean type and means not true);
196 clap.play();
197 }close braces end code blocks and must match an earlier open brace
198 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 'q')
199 {open braces start code blocks and must be matched with a close brace
200 left.setVisible(falsefalse is a value for the boolean type and means not true);
201 one_left.setVisible(falsefalse is a value for the boolean type and means not true);
202 center.setVisible(falsefalse is a value for the boolean type and means not true);
203 center.setVisible(falsefalse is a value for the boolean type and means not true);
204 win.setVisible(truetrue is the boolean value that is the opposite of false);
205 lose.setVisible(falsefalse is a value for the boolean type and means not true);
206 decision.setVisible(falsefalse is a value for the boolean type and means not true);
207 title.setVisible(falsefalse is a value for the boolean type and means not true);
208 clap.play();
209 }close braces end code blocks and must match an earlier open brace
210 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 'w')
211 {open braces start code blocks and must be matched with a close brace
212 left.setVisible(falsefalse is a value for the boolean type and means not true);
213 one_left.setVisible(falsefalse is a value for the boolean type and means not true);
214 center.setVisible(falsefalse is a value for the boolean type and means not true);
215 two_center.setVisible(falsefalse is a value for the boolean type and means not true);
216 win.setVisible(falsefalse is a value for the boolean type and means not true);
217 lose.setVisible(truetrue is the boolean value that is the opposite of false);
218 decision.setVisible(falsefalse is a value for the boolean type and means not true);
219 title.setVisible(falsefalse is a value for the boolean type and means not true);
220 clap.play();
221 }close braces end code blocks and must match an earlier open brace
222 elseelse is what happens when the if condition is false ifif executes the next statement only if the condition in parenthesis evaluates to true(z==this is the comparison operator which evaluates to true if both sides are the same2)
223 {open braces start code blocks and must be matched with a close brace
224 right.setVisible(falsefalse is a value for the boolean type and means not true);
225 three_right.setVisible(falsefalse is a value for the boolean type and means not true);
226 demand.setVisible(falsefalse is a value for the boolean type and means not true);
227 decision.setVisible(truetrue is the boolean value that is the opposite of false);
228 title.setVisible(falsefalse is a value for the boolean type and means not true);
229 clap.play();
230 }close braces end code blocks and must match an earlier open brace
231 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 'q')
232 {open braces start code blocks and must be matched with a close brace
233 left.setVisible(falsefalse is a value for the boolean type and means not true);
234 one_left.setVisible(falsefalse is a value for the boolean type and means not true);
235 center.setVisible(falsefalse is a value for the boolean type and means not true);
236 two_center.setVisible(falsefalse is a value for the boolean type and means not true);
237 lose.setVisible(truetrue is the boolean value that is the opposite of false);
238 win.setVisible(falsefalse is a value for the boolean type and means not true);
239 decision.setVisible(falsefalse is a value for the boolean type and means not true);
240 title.setVisible(falsefalse is a value for the boolean type and means not true);
241 clap.play();
242 }close braces end code blocks and must match an earlier open brace
243 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 'w')
244 {open braces start code blocks and must be matched with a close brace
245 left.setVisible(falsefalse is a value for the boolean type and means not true);
246 one_left.setVisible(falsefalse is a value for the boolean type and means not true);
247 center.setVisible(falsefalse is a value for the boolean type and means not true);
248 two_center.setVisible(falsefalse is a value for the boolean type and means not true);
249 win.setVisible(truetrue is the boolean value that is the opposite of false);
250 lose.setVisible(falsefalse is a value for the boolean type and means not true);
251 decision.setVisible(falsefalse is a value for the boolean type and means not true);
252 title.setVisible(falsefalse is a value for the boolean type and means not true);
253 clap.play();
254 }close braces end code blocks and must match an earlier open brace
255 elseelse is what happens when the if condition is false ifif executes the next statement only if the condition in parenthesis evaluates to true(z==this is the comparison operator which evaluates to true if both sides are the same3)
256 {open braces start code blocks and must be matched with a close brace
257 center.setVisible(falsefalse is a value for the boolean type and means not true);
258 two_center.setVisible(falsefalse is a value for the boolean type and means not true);
259 demand.setVisible(falsefalse is a value for the boolean type and means not true);
260 decision.setVisible(truetrue is the boolean value that is the opposite of false);
261 title.setVisible(falsefalse is a value for the boolean type and means not true);
262 clap.play();
263 }close braces end code blocks and must match an earlier open brace
264 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 'q')
265 {open braces start code blocks and must be matched with a close brace
266 left.setVisible(falsefalse is a value for the boolean type and means not true);
267 one_left.setVisible(falsefalse is a value for the boolean type and means not true);
268 right.setVisible(falsefalse is a value for the boolean type and means not true);
269 three_right.setVisible(falsefalse is a value for the boolean type and means not true);
270 lose.setVisible(truetrue is the boolean value that is the opposite of false);
271 win.setVisible(falsefalse is a value for the boolean type and means not true);
272 decision.setVisible(falsefalse is a value for the boolean type and means not true);
273 title.setVisible(falsefalse is a value for the boolean type and means not true);
274 clap.play();
275 }close braces end code blocks and must match an earlier open brace
276 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 'w')
277 {open braces start code blocks and must be matched with a close brace
278 left.setVisible(falsefalse is a value for the boolean type and means not true);
279 one_left.setVisible(falsefalse is a value for the boolean type and means not true);
280 right.setVisible(falsefalse is a value for the boolean type and means not true);
281 three_right.setVisible(falsefalse is a value for the boolean type and means not true);
282 win.setVisible(truetrue is the boolean value that is the opposite of false);
283 lose.setVisible(falsefalse is a value for the boolean type and means not true);
284 decision.setVisible(falsefalse is a value for the boolean type and means not true);
285 title.setVisible(falsefalse is a value for the boolean type and means not true);
286 clap.play();
287 }close braces end code blocks and must match an earlier open brace
288 }close braces end code blocks and must match an earlier open brace
289 }close braces end code blocks and must match an earlier open brace
290 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value center()
291 {open braces start code blocks and must be matched with a close brace
292 /**THE OPTIONS OF WHAT HAPPENS WHEN ONE CLICKS ON A DOOR AND PRESSES Q OR W. THIS CASE THE CENTER DOOR*/
293 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 differentnullnull 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 &&) center.intersects(getClick2D()))
294 //REMINDER z=random.nextInt(3)+1;
295 {open braces start code blocks and must be matched with a close brace
296 numClicks++this is the increment operator, which increases the variable by 1;
297 }close braces end code blocks and must match an earlier open brace
298 ifif executes the next statement only if the condition in parenthesis evaluates to true(numClicks==this is the comparison operator which evaluates to true if both sides are the same2)
299 {open braces start code blocks and must be matched with a close brace
300 ifif executes the next statement only if the condition in parenthesis evaluates to true(z==this is the comparison operator which evaluates to true if both sides are the same1)
301 {open braces start code blocks and must be matched with a close brace
302 right.setVisible(falsefalse is a value for the boolean type and means not true);
303 three_right.setVisible(falsefalse is a value for the boolean type and means not true);
304 demand.setVisible(falsefalse is a value for the boolean type and means not true);
305 decision.setVisible(truetrue is the boolean value that is the opposite of false);
306 title.setVisible(falsefalse is a value for the boolean type and means not true);
307 clap.play();
308 }close braces end code blocks and must match an earlier open brace
309 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 'q')
310 {open braces start code blocks and must be matched with a close brace
311 left.setVisible(falsefalse is a value for the boolean type and means not true);
312 one_left.setVisible(falsefalse is a value for the boolean type and means not true);
313 center.setVisible(falsefalse is a value for the boolean type and means not true);
314 two_center.setVisible(falsefalse is a value for the boolean type and means not true);
315 lose.setVisible(truetrue is the boolean value that is the opposite of false);
316 decision.setVisible(falsefalse is a value for the boolean type and means not true);
317 title.setVisible(falsefalse is a value for the boolean type and means not true);
318 clap.play();
319 }close braces end code blocks and must match an earlier open brace
320 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 'w')
321 {open braces start code blocks and must be matched with a close brace
322 left.setVisible(falsefalse is a value for the boolean type and means not true);
323 one_left.setVisible(falsefalse is a value for the boolean type and means not true);
324 center.setVisible(falsefalse is a value for the boolean type and means not true);
325 two_center.setVisible(falsefalse is a value for the boolean type and means not true);
326 win.setVisible(truetrue is the boolean value that is the opposite of false);
327 decision.setVisible(falsefalse is a value for the boolean type and means not true);
328 title.setVisible(falsefalse is a value for the boolean type and means not true);
329 clap.play();
330 }close braces end code blocks and must match an earlier open brace
331 elseelse is what happens when the if condition is false ifif executes the next statement only if the condition in parenthesis evaluates to true(z==this is the comparison operator which evaluates to true if both sides are the same2)
332 {open braces start code blocks and must be matched with a close brace
333 left.setVisible(falsefalse is a value for the boolean type and means not true);
334 one_left.setVisible(falsefalse is a value for the boolean type and means not true);
335 demand.setVisible(falsefalse is a value for the boolean type and means not true);
336 decision.setVisible(truetrue is the boolean value that is the opposite of false);
337 title.setVisible(falsefalse is a value for the boolean type and means not true);
338 clap.play();
339 }close braces end code blocks and must match an earlier open brace
340 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 'q')
341 {open braces start code blocks and must be matched with a close brace
342 center.setVisible(falsefalse is a value for the boolean type and means not true);
343 two_center.setVisible(falsefalse is a value for the boolean type and means not true);
344 right.setVisible(falsefalse is a value for the boolean type and means not true);
345 three_right.setVisible(falsefalse is a value for the boolean type and means not true);
346 win.setVisible(truetrue is the boolean value that is the opposite of false);
347 decision.setVisible(falsefalse is a value for the boolean type and means not true);
348 title.setVisible(falsefalse is a value for the boolean type and means not true);
349 clap.play();
350 }close braces end code blocks and must match an earlier open brace
351 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 'w')
352 {open braces start code blocks and must be matched with a close brace
353 center.setVisible(falsefalse is a value for the boolean type and means not true);
354 two_center.setVisible(falsefalse is a value for the boolean type and means not true);
355 right.setVisible(falsefalse is a value for the boolean type and means not true);
356 three_right.setVisible(falsefalse is a value for the boolean type and means not true);
357 lose.setVisible(truetrue is the boolean value that is the opposite of false);
358 decision.setVisible(falsefalse is a value for the boolean type and means not true);
359 title.setVisible(falsefalse is a value for the boolean type and means not true);
360 clap.play();
361 }close braces end code blocks and must match an earlier open brace
362 ifif executes the next statement only if the condition in parenthesis evaluates to true (z==this is the comparison operator which evaluates to true if both sides are the same3)
363 {open braces start code blocks and must be matched with a close brace
364 left.setVisible(falsefalse is a value for the boolean type and means not true);
365 one_left.setVisible(falsefalse is a value for the boolean type and means not true);
366 demand.setVisible(falsefalse is a value for the boolean type and means not true);
367 decision.setVisible(truetrue is the boolean value that is the opposite of false);
368 title.setVisible(falsefalse is a value for the boolean type and means not true);
369 clap.play();
370 }close braces end code blocks and must match an earlier open brace
371 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 'q')
372 {open braces start code blocks and must be matched with a close brace
373 center.setVisible(falsefalse is a value for the boolean type and means not true);
374 two_center.setVisible(falsefalse is a value for the boolean type and means not true);
375 right.setVisible(falsefalse is a value for the boolean type and means not true);
376 three_right.setVisible(falsefalse is a value for the boolean type and means not true);
377 lose.setVisible(truetrue is the boolean value that is the opposite of false);
378 decision.setVisible(falsefalse is a value for the boolean type and means not true);
379 title.setVisible(falsefalse is a value for the boolean type and means not true);
380 clap.play();
381 }close braces end code blocks and must match an earlier open brace
382 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 'w')
383 {open braces start code blocks and must be matched with a close brace
384 center.setVisible(falsefalse is a value for the boolean type and means not true);
385 two_center.setVisible(falsefalse is a value for the boolean type and means not true);
386 right.setVisible(falsefalse is a value for the boolean type and means not true);
387 three_right.setVisible(falsefalse is a value for the boolean type and means not true);
388 win.setVisible(truetrue is the boolean value that is the opposite of false);
389 decision.setVisible(falsefalse is a value for the boolean type and means not true);
390 title.setVisible(falsefalse is a value for the boolean type and means not true);
391 clap.play();
392 }close braces end code blocks and must match an earlier open brace
393 }close braces end code blocks and must match an earlier open brace
394 }close braces end code blocks and must match an earlier open brace
395
396 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value right()
397 {open braces start code blocks and must be matched with a close brace
398 /**THE OPTIONS OF WHAT HAPPENS WHEN ONE CLICKS ON A DOOR AND PRESSES Q OR W. THIS CASE THE RIGHT DOOR*/
399 //REMINDER z=random.nextInt(3)+1;
400 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 differentnullnull 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 &&) right.intersects(getClick2D()))
401 {open braces start code blocks and must be matched with a close brace
402 numClicks++this is the increment operator, which increases the variable by 1;
403 }close braces end code blocks and must match an earlier open brace
404 ifif executes the next statement only if the condition in parenthesis evaluates to true(numClicks==this is the comparison operator which evaluates to true if both sides are the same3)
405 {open braces start code blocks and must be matched with a close brace
406 ifif executes the next statement only if the condition in parenthesis evaluates to true(z==this is the comparison operator which evaluates to true if both sides are the same1)
407 {open braces start code blocks and must be matched with a close brace
408 center.setVisible(falsefalse is a value for the boolean type and means not true);
409 two_center.setVisible(falsefalse is a value for the boolean type and means not true);
410 demand.setVisible(falsefalse is a value for the boolean type and means not true);
411 decision.setVisible(truetrue is the boolean value that is the opposite of false);
412 title.setVisible(falsefalse is a value for the boolean type and means not true);
413 clap.play();
414 }close braces end code blocks and must match an earlier open brace
415 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 'q')
416 {open braces start code blocks and must be matched with a close brace
417 left.setVisible(falsefalse is a value for the boolean type and means not true);
418 one_left.setVisible(falsefalse is a value for the boolean type and means not true);
419 center.setVisible(falsefalse is a value for the boolean type and means not true);
420 two_center.setVisible(falsefalse is a value for the boolean type and means not true);
421 lose.setVisible(truetrue is the boolean value that is the opposite of false);
422 decision.setVisible(falsefalse is a value for the boolean type and means not true);
423 title.setVisible(falsefalse is a value for the boolean type and means not true);
424 restart.setVisible(truetrue is the boolean value that is the opposite of false);
425 clap.play();
426 }close braces end code blocks and must match an earlier open brace
427 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 'w')
428 {open braces start code blocks and must be matched with a close brace
429 left.setVisible(falsefalse is a value for the boolean type and means not true);
430 one_left.setVisible(falsefalse is a value for the boolean type and means not true);
431 center.setVisible(falsefalse is a value for the boolean type and means not true);
432 two_center.setVisible(falsefalse is a value for the boolean type and means not true);
433 win.setVisible(truetrue is the boolean value that is the opposite of false);
434 decision.setVisible(falsefalse is a value for the boolean type and means not true);
435 title.setVisible(falsefalse is a value for the boolean type and means not true);
436 restart.setVisible(truetrue is the boolean value that is the opposite of false);
437 clap.play();
438 }close braces end code blocks and must match an earlier open brace
439
440 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 'r')
441 {open braces start code blocks and must be matched with a close brace
442 left();
443 center();
444 right();
445 clap.play();
446 }close braces end code blocks and must match an earlier open brace
447
448 elseelse is what happens when the if condition is false ifif executes the next statement only if the condition in parenthesis evaluates to true(z==this is the comparison operator which evaluates to true if both sides are the same2)
449 {open braces start code blocks and must be matched with a close brace
450 left.setVisible(falsefalse is a value for the boolean type and means not true);
451 one_left.setVisible(falsefalse is a value for the boolean type and means not true);
452 demand.setVisible(falsefalse is a value for the boolean type and means not true);
453 decision.setVisible(truetrue is the boolean value that is the opposite of false);
454 title.setVisible(falsefalse is a value for the boolean type and means not true);
455 clap.play();
456 }close braces end code blocks and must match an earlier open brace
457 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 'q')
458 {open braces start code blocks and must be matched with a close brace
459 center.setVisible(falsefalse is a value for the boolean type and means not true);
460 two_center.setVisible(falsefalse is a value for the boolean type and means not true);
461 right.setVisible(falsefalse is a value for the boolean type and means not true);
462 three_right.setVisible(falsefalse is a value for the boolean type and means not true);
463 lose.setVisible(truetrue is the boolean value that is the opposite of false);
464 decision.setVisible(falsefalse is a value for the boolean type and means not true);
465 title.setVisible(falsefalse is a value for the boolean type and means not true);
466 restart.setVisible(truetrue is the boolean value that is the opposite of false);
467 clap.play();
468 }close braces end code blocks and must match an earlier open brace
469 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 'w')
470 {open braces start code blocks and must be matched with a close brace
471 center.setVisible(falsefalse is a value for the boolean type and means not true);
472 two_center.setVisible(falsefalse is a value for the boolean type and means not true);
473 right.setVisible(falsefalse is a value for the boolean type and means not true);
474 three_right.setVisible(falsefalse is a value for the boolean type and means not true);
475 win.setVisible(truetrue is the boolean value that is the opposite of false);
476 decision.setVisible(falsefalse is a value for the boolean type and means not true);
477 title.setVisible(falsefalse is a value for the boolean type and means not true);
478 restart.setVisible(truetrue is the boolean value that is the opposite of false);
479 clap.play();
480
481 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 'r')
482 {open braces start code blocks and must be matched with a close brace
483 left();
484 center();
485 right();
486 clap.play();
487 }close braces end code blocks and must match an earlier open brace
488 }close braces end code blocks and must match an earlier open brace
489 elseelse is what happens when the if condition is false ifif executes the next statement only if the condition in parenthesis evaluates to true(z==this is the comparison operator which evaluates to true if both sides are the same3)
490 {open braces start code blocks and must be matched with a close brace
491 center.setVisible(falsefalse is a value for the boolean type and means not true);
492 two_center.setVisible(falsefalse is a value for the boolean type and means not true);
493 demand.setVisible(falsefalse is a value for the boolean type and means not true);
494 decision.setVisible(truetrue is the boolean value that is the opposite of false);
495 title.setVisible(falsefalse is a value for the boolean type and means not true);
496 clap.play();
497 }close braces end code blocks and must match an earlier open brace
498 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 'q')
499 {open braces start code blocks and must be matched with a close brace
500 left.setVisible(falsefalse is a value for the boolean type and means not true);
501 one_left.setVisible(falsefalse is a value for the boolean type and means not true);
502 right.setVisible(falsefalse is a value for the boolean type and means not true);
503 three_right.setVisible(falsefalse is a value for the boolean type and means not true);
504 win.setVisible(truetrue is the boolean value that is the opposite of false);
505 decision.setVisible(falsefalse is a value for the boolean type and means not true);
506 title.setVisible(falsefalse is a value for the boolean type and means not true);
507 restart.setVisible(truetrue is the boolean value that is the opposite of false);
508 clap.play();
509 }close braces end code blocks and must match an earlier open brace
510 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 'w')
511 {open braces start code blocks and must be matched with a close brace
512 left.setVisible(falsefalse is a value for the boolean type and means not true);
513 one_left.setVisible(falsefalse is a value for the boolean type and means not true);
514 right.setVisible(falsefalse is a value for the boolean type and means not true);
515 three_right.setVisible(falsefalse is a value for the boolean type and means not true);
516 lose.setVisible(truetrue is the boolean value that is the opposite of false);
517 decision.setVisible(falsefalse is a value for the boolean type and means not true);
518 title.setVisible(falsefalse is a value for the boolean type and means not true);
519 restart.setVisible(truetrue is the boolean value that is the opposite of false);
520 clap.play();
521
522 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 'r')
523 {open braces start code blocks and must be matched with a close brace
524 left();
525 center();
526 right();
527 clap.play();
528 }close braces end code blocks and must match an earlier open brace
529 }close braces end code blocks and must match an earlier open brace
530 }close braces end code blocks and must match an earlier open brace
531 }close braces end code blocks and must match an earlier open brace
532 }close braces end code blocks and must match an earlier open brace
|