|
001 packagepackage is used to name the directory or folder a class is in Min;
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 My Name Here
011 */
012 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 letsdeal extendsextends means to customize or extend the functionality of a class Game
013 {open braces start code blocks and must be matched with a close brace
014
015 privateprivate is used to restrict access to the current class only ImageSprite door1, door2, door3;
016 privateprivate is used to restrict access to the current class only ImageSprite loser1, loser2;
017 privateprivate is used to restrict access to the current class only ImageSprite winner;
018 privateprivate is used to restrict access to the current class only StringSprite header;
019 privateprivate is used to restrict access to the current class only StringSprite answer;
020 privateprivate is used to restrict access to the current class only StringSprite num1, num2, num3;
021 privateprivate is used to restrict access to the current class only StringSprite win;
022 privateprivate is used to restrict access to the current class only StringSprite fail;
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 doorpicked;
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 clickcount =this assignment operator makes the left side equal to the right side 0;
025 privateprivate is used to restrict access to the current class only intint is the type for whole numbers and it is short for integer i;
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 x;
027 privateprivate is used to restrict access to the current class only intint is the type for whole numbers and it is short for integer j;
028 privateprivate is used to restrict access to the current class only intint is the type for whole numbers and it is short for integer z;
029 privateprivate is used to restrict access to the current class only intint is the type for whole numbers and it is short for integer open;
030 privateprivate is used to restrict access to the current class only intint is the type for whole numbers and it is short for integer notopen;
031 /**sets up the game*/
032 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setup()
033 {open braces start code blocks and must be matched with a close brace
034 clickcount=this assignment operator makes the left side equal to the right side0;
035 makeSprite();
036 addSprite();
037 x=this assignment operator makes the left side equal to the right siderandom.nextInt(2)+adds two numbers together or concatenates Strings together1;
038 }close braces end code blocks and must match an earlier open brace
039 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makeSprite()
040 {open braces start code blocks and must be matched with a close brace
041 door1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("Door123444.jpg");
042 door1.setLocation(.2, .5);
043 door1.setScale(.5);
044 door1.setVisible(truetrue is the boolean value that is the opposite of false);
045
046 door2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("Door123444.jpg");
047 door2.setLocation(.5, .5);
048 door2.setScale(.5);
049 door2.setVisible(truetrue is the boolean value that is the opposite of false);
050
051 door3=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("Door123444.jpg");
052 door3.setLocation(.8, .5);
053 door3.setScale(.5);
054 door3.setVisible(truetrue is the boolean value that is the opposite of false);
055
056 header=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Choose a door");
057 header.setLocation(.5, .2);
058 header.setSize(.3);
059 addSprite(header);
060
061 num1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("1");
062 num1.setLocation(.2, .85);
063 num1.setSize(.15);
064
065 num2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("2");
066 num2.setLocation(.5, .85);
067 num2.setSize(.15);
068
069 num3=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("3");
070 num3.setLocation(.8, .85);
071 num3.setSize(.15);
072
073 answer=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("q to stay w to switch!!");
074 answer.setSize(.5);
075 answer.setLocation(.5, .1);
076 answer.setVisible(falsefalse is a value for the boolean type and means not true);
077 addSprite(answer);
078
079 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");
080 win.setLocation(.5, .3);
081 win.setSize(.25);
082
083 fail=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Failed!!");
084 fail.setLocation(.5, .3);
085 fail.setSize(.25);
086
087 loser1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("Loser0000.JPG");
088 loser1.setScale(.1);
089 loser1.setLocation(.2, .5);
090 loser2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("Loser0000.JPG");
091 loser2.setScale(.1);
092 loser2.setLocation(.5, .5);
093 winner=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("Win12333333.jpg");
094 winner.setScale(.1);
095 winner.setLocation(.8, .5);
096 }close braces end code blocks and must match an earlier open brace
097 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value addSprite()
098 {open braces start code blocks and must be matched with a close brace
099 canvas.addSprite(door1);
100 canvas.addSprite(door2);
101 canvas.addSprite(door3);
102 canvas.addSprite(num1);
103 canvas.addSprite(num2);
104 canvas.addSprite(num3);
105 }close braces end code blocks and must match an earlier open brace
106 /**handle input and game events*/
107 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value advance()
108 {open braces start code blocks and must be matched with a close brace
109 Point2D.Double click=this assignment operator makes the left side equal to the right sidegetPlayer().getMouse().getClickLocation();
110 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 &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 &&) clickcount ==this is the comparison operator which evaluates to true if both sides are the same 0)
111 {open braces start code blocks and must be matched with a close brace
112 ifif executes the next statement only if the condition in parenthesis evaluates to true (door1.intersects(click))
113 {open braces start code blocks and must be matched with a close brace
114 clickcount=this assignment operator makes the left side equal to the right side1;
115 x=this assignment operator makes the left side equal to the right siderandom.nextInt(2)+adds two numbers together or concatenates Strings together1;
116 doorpicked=this assignment operator makes the left side equal to the right side1;
117 ifif executes the next statement only if the condition in parenthesis evaluates to true(x==this is the comparison operator which evaluates to true if both sides are the same1)
118 {open braces start code blocks and must be matched with a close brace
119 loser1.setLocation(door2.getLocation());
120 canvas.removeSprite(door2);
121 addSprite(loser1);
122 open=this assignment operator makes the left side equal to the right side2;
123 notopen=this assignment operator makes the left side equal to the right side3;
124 }close braces end code blocks and must match an earlier open brace
125 elseelse is what happens when the if condition is false ifif executes the next statement only if the condition in parenthesis evaluates to true(x==this is the comparison operator which evaluates to true if both sides are the same2)
126 {open braces start code blocks and must be matched with a close brace
127 loser1.setLocation(door3.getLocation());
128 canvas.removeSprite(door3);
129 addSprite(loser1);
130 open=this assignment operator makes the left side equal to the right side3;
131 notopen=this assignment operator makes the left side equal to the right side2;
132 }close braces end code blocks and must match an earlier open brace
133 answer.setVisible(truetrue is the boolean value that is the opposite of false);
134 header.setVisible(falsefalse is a value for the boolean type and means not true);
135 }close braces end code blocks and must match an earlier open brace
136
137 ifif executes the next statement only if the condition in parenthesis evaluates to true (door2.intersects(click))
138 {open braces start code blocks and must be matched with a close brace
139 clickcount=this assignment operator makes the left side equal to the right side1;
140 j=this assignment operator makes the left side equal to the right siderandom.nextInt(2)+adds two numbers together or concatenates Strings together1;
141 doorpicked=this assignment operator makes the left side equal to the right side2;
142 ifif executes the next statement only if the condition in parenthesis evaluates to true(j==this is the comparison operator which evaluates to true if both sides are the same1)
143 {open braces start code blocks and must be matched with a close brace
144 loser1.setLocation(door1.getLocation());
145 canvas.removeSprite(door1);
146 addSprite(loser1);
147 open=this assignment operator makes the left side equal to the right side1;
148 notopen=this assignment operator makes the left side equal to the right side3;
149 }close braces end code blocks and must match an earlier open brace
150 elseelse is what happens when the if condition is false ifif executes the next statement only if the condition in parenthesis evaluates to true(j==this is the comparison operator which evaluates to true if both sides are the same2)
151 {open braces start code blocks and must be matched with a close brace
152 loser1.setLocation(door3.getLocation());
153 canvas.removeSprite(door3);
154 addSprite(loser1);
155 open=this assignment operator makes the left side equal to the right side3;
156 notopen=this assignment operator makes the left side equal to the right side1;
157 }close braces end code blocks and must match an earlier open brace
158 answer.setVisible(truetrue is the boolean value that is the opposite of false);
159 header.setVisible(falsefalse is a value for the boolean type and means not true);
160 }close braces end code blocks and must match an earlier open brace
161 ifif executes the next statement only if the condition in parenthesis evaluates to true(door3.intersects(click))
162 {open braces start code blocks and must be matched with a close brace
163 clickcount=this assignment operator makes the left side equal to the right side1;
164 z=this assignment operator makes the left side equal to the right siderandom.nextInt(2)+adds two numbers together or concatenates Strings together1;
165 doorpicked=this assignment operator makes the left side equal to the right side3;
166 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)
167 {open braces start code blocks and must be matched with a close brace
168 loser1.setLocation(door1.getLocation());
169 canvas.removeSprite(door1);
170 addSprite(loser1);
171 open=this assignment operator makes the left side equal to the right side1;
172 notopen=this assignment operator makes the left side equal to the right side2;
173 }close braces end code blocks and must match an earlier open brace
174 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)
175 {open braces start code blocks and must be matched with a close brace
176 loser1.setLocation(door2.getLocation());
177 canvas.removeSprite(door2);
178 addSprite(loser1);
179 open=this assignment operator makes the left side equal to the right side2;
180 notopen=this assignment operator makes the left side equal to the right side1;
181 }close braces end code blocks and must match an earlier open brace
182 answer.setVisible(truetrue is the boolean value that is the opposite of false);
183 header.setVisible(falsefalse is a value for the boolean type and means not true);
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 ifif executes the next statement only if the condition in parenthesis evaluates to true(getPlayer().getKeyboard().getLastKey() ==this is the comparison operator which evaluates to true if both sides are the same 'q')
187 {open braces start code blocks and must be matched with a close brace
188 ifif executes the next statement only if the condition in parenthesis evaluates to true(clickcount==this is the comparison operator which evaluates to true if both sides are the same1)
189 {open braces start code blocks and must be matched with a close brace
190 i=this assignment operator makes the left side equal to the right siderandom.nextInt(2)+adds two numbers together or concatenates Strings together1;
191 ifif executes the next statement only if the condition in parenthesis evaluates to true(doorpicked==this is the comparison operator which evaluates to true if both sides are the same1 &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 &&) notopen ==this is the comparison operator which evaluates to true if both sides are the same 3)
192 {open braces start code blocks and must be matched with a close brace
193 ifif executes the next statement only if the condition in parenthesis evaluates to true(i ==this is the comparison operator which evaluates to true if both sides are the same 1)
194 {open braces start code blocks and must be matched with a close brace
195 winner.setLocation(door1.getLocation());
196 loser2.setLocation(door3.getLocation());
197 canvas.addSprite(win);
198 }close braces end code blocks and must match an earlier open brace
199 ifif executes the next statement only if the condition in parenthesis evaluates to true(i ==this is the comparison operator which evaluates to true if both sides are the same 2)
200 {open braces start code blocks and must be matched with a close brace
201 loser2.setLocation(door1.getLocation());
202 winner.setLocation(door3.getLocation());
203 canvas.addSprite(fail);
204 }close braces end code blocks and must match an earlier open brace
205 }close braces end code blocks and must match an earlier open brace
206 ifif executes the next statement only if the condition in parenthesis evaluates to true(doorpicked==this is the comparison operator which evaluates to true if both sides are the same1 &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 &&) notopen ==this is the comparison operator which evaluates to true if both sides are the same 2)
207 {open braces start code blocks and must be matched with a close brace
208 ifif executes the next statement only if the condition in parenthesis evaluates to true(i ==this is the comparison operator which evaluates to true if both sides are the same 1)
209 {open braces start code blocks and must be matched with a close brace
210 winner.setLocation(door1.getLocation());
211 loser2.setLocation(door2.getLocation());
212 canvas.addSprite(win);
213 }close braces end code blocks and must match an earlier open brace
214 ifif executes the next statement only if the condition in parenthesis evaluates to true(i ==this is the comparison operator which evaluates to true if both sides are the same 2)
215 {open braces start code blocks and must be matched with a close brace
216 loser2.setLocation(door1.getLocation());
217 winner.setLocation(door2.getLocation());
218 canvas.addSprite(fail);
219 }close braces end code blocks and must match an earlier open brace
220 }close braces end code blocks and must match an earlier open brace
221 ifif executes the next statement only if the condition in parenthesis evaluates to true(doorpicked==this is the comparison operator which evaluates to true if both sides are the same2 &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 &&) notopen ==this is the comparison operator which evaluates to true if both sides are the same 1)
222 {open braces start code blocks and must be matched with a close brace
223 ifif executes the next statement only if the condition in parenthesis evaluates to true(i ==this is the comparison operator which evaluates to true if both sides are the same 1)
224 {open braces start code blocks and must be matched with a close brace
225 winner.setLocation(door2.getLocation());
226 loser2.setLocation(door1.getLocation());
227 canvas.addSprite(win);
228 }close braces end code blocks and must match an earlier open brace
229 ifif executes the next statement only if the condition in parenthesis evaluates to true(i ==this is the comparison operator which evaluates to true if both sides are the same 2)
230 {open braces start code blocks and must be matched with a close brace
231 loser2.setLocation(door2.getLocation());
232 winner.setLocation(door1.getLocation());
233 canvas.addSprite(fail);
234 }close braces end code blocks and must match an earlier open brace
235 }close braces end code blocks and must match an earlier open brace
236 ifif executes the next statement only if the condition in parenthesis evaluates to true(doorpicked==this is the comparison operator which evaluates to true if both sides are the same2 &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 &&) notopen ==this is the comparison operator which evaluates to true if both sides are the same 3)
237 {open braces start code blocks and must be matched with a close brace
238 ifif executes the next statement only if the condition in parenthesis evaluates to true(i ==this is the comparison operator which evaluates to true if both sides are the same 1)
239 {open braces start code blocks and must be matched with a close brace
240 winner.setLocation(door2.getLocation());
241 loser2.setLocation(door3.getLocation());
242 canvas.addSprite(win);
243 }close braces end code blocks and must match an earlier open brace
244 ifif executes the next statement only if the condition in parenthesis evaluates to true(i ==this is the comparison operator which evaluates to true if both sides are the same 2)
245 {open braces start code blocks and must be matched with a close brace
246 loser2.setLocation(door2.getLocation());
247 winner.setLocation(door3.getLocation());
248 canvas.addSprite(fail);
249 }close braces end code blocks and must match an earlier open brace
250 }close braces end code blocks and must match an earlier open brace
251 ifif executes the next statement only if the condition in parenthesis evaluates to true(doorpicked==this is the comparison operator which evaluates to true if both sides are the same3 &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 &&) notopen ==this is the comparison operator which evaluates to true if both sides are the same 1)
252 {open braces start code blocks and must be matched with a close brace
253 ifif executes the next statement only if the condition in parenthesis evaluates to true(i ==this is the comparison operator which evaluates to true if both sides are the same 1)
254 {open braces start code blocks and must be matched with a close brace
255 winner.setLocation(door3.getLocation());
256 loser2.setLocation(door1.getLocation());
257 canvas.addSprite(win);
258 }close braces end code blocks and must match an earlier open brace
259 ifif executes the next statement only if the condition in parenthesis evaluates to true(i ==this is the comparison operator which evaluates to true if both sides are the same 2)
260 {open braces start code blocks and must be matched with a close brace
261 loser2.setLocation(door3.getLocation());
262 winner.setLocation(door1.getLocation());
263 canvas.addSprite(fail);
264 }close braces end code blocks and must match an earlier open brace
265 }close braces end code blocks and must match an earlier open brace
266 ifif executes the next statement only if the condition in parenthesis evaluates to true(doorpicked==this is the comparison operator which evaluates to true if both sides are the same3 &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 &&) notopen ==this is the comparison operator which evaluates to true if both sides are the same 2)
267 {open braces start code blocks and must be matched with a close brace
268 ifif executes the next statement only if the condition in parenthesis evaluates to true(i ==this is the comparison operator which evaluates to true if both sides are the same 1)
269 {open braces start code blocks and must be matched with a close brace
270 winner.setLocation(door3.getLocation());
271 loser2.setLocation(door2.getLocation());
272 canvas.addSprite(win);
273 }close braces end code blocks and must match an earlier open brace
274 ifif executes the next statement only if the condition in parenthesis evaluates to true(i ==this is the comparison operator which evaluates to true if both sides are the same 2)
275 {open braces start code blocks and must be matched with a close brace
276 loser2.setLocation(door3.getLocation());
277 winner.setLocation(door2.getLocation());
278 canvas.addSprite(fail);
279 }close braces end code blocks and must match an earlier open brace
280 }close braces end code blocks and must match an earlier open brace
281 canvas.removeSprite(door1);
282 canvas.removeSprite(door2);
283 canvas.removeSprite(door3);
284 canvas.addSprite(winner);
285 canvas.addSprite(loser2);
286 }close braces end code blocks and must match an earlier open brace
287 }close braces end code blocks and must match an earlier open brace
288 ifif executes the next statement only if the condition in parenthesis evaluates to true(getPlayer().getKeyboard().getLastKey() ==this is the comparison operator which evaluates to true if both sides are the same 'w')
289 ifif executes the next statement only if the condition in parenthesis evaluates to true (clickcount==this is the comparison operator which evaluates to true if both sides are the same1)
290 {open braces start code blocks and must be matched with a close brace
291 i =this assignment operator makes the left side equal to the right side random.nextInt(2)+adds two numbers together or concatenates Strings together1;
292 ifif executes the next statement only if the condition in parenthesis evaluates to true (doorpicked==this is the comparison operator which evaluates to true if both sides are the same1 &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 &&) notopen ==this is the comparison operator which evaluates to true if both sides are the same 3)
293 {open braces start code blocks and must be matched with a close brace
294 ifif executes the next statement only if the condition in parenthesis evaluates to true(i ==this is the comparison operator which evaluates to true if both sides are the same 1)
295 {open braces start code blocks and must be matched with a close brace
296 winner.setLocation(door1.getLocation());
297 loser2.setLocation(door3.getLocation());
298 canvas.addSprite(fail);
299 }close braces end code blocks and must match an earlier open brace
300 ifif executes the next statement only if the condition in parenthesis evaluates to true(i ==this is the comparison operator which evaluates to true if both sides are the same 2)
301 {open braces start code blocks and must be matched with a close brace
302 loser2.setLocation(door1.getLocation());
303 winner.setLocation(door3.getLocation());
304 canvas.addSprite(win);
305 }close braces end code blocks and must match an earlier open brace
306 }close braces end code blocks and must match an earlier open brace
307 ifif executes the next statement only if the condition in parenthesis evaluates to true (doorpicked==this is the comparison operator which evaluates to true if both sides are the same1 &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 &&) notopen ==this is the comparison operator which evaluates to true if both sides are the same 2)
308 {open braces start code blocks and must be matched with a close brace
309 ifif executes the next statement only if the condition in parenthesis evaluates to true(i ==this is the comparison operator which evaluates to true if both sides are the same 1)
310 {open braces start code blocks and must be matched with a close brace
311 winner.setLocation(door1.getLocation());
312 loser2.setLocation(door2.getLocation());
313 canvas.addSprite(fail);
314 }close braces end code blocks and must match an earlier open brace
315 ifif executes the next statement only if the condition in parenthesis evaluates to true(i ==this is the comparison operator which evaluates to true if both sides are the same 2)
316 {open braces start code blocks and must be matched with a close brace
317 loser2.setLocation(door1.getLocation());
318 winner.setLocation(door2.getLocation());
319 canvas.addSprite(win);
320 }close braces end code blocks and must match an earlier open brace
321 }close braces end code blocks and must match an earlier open brace
322 ifif executes the next statement only if the condition in parenthesis evaluates to true (doorpicked==this is the comparison operator which evaluates to true if both sides are the same2 &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 &&) notopen ==this is the comparison operator which evaluates to true if both sides are the same 1)
323 {open braces start code blocks and must be matched with a close brace
324 ifif executes the next statement only if the condition in parenthesis evaluates to true(i ==this is the comparison operator which evaluates to true if both sides are the same 1)
325 {open braces start code blocks and must be matched with a close brace
326 winner.setLocation(door2.getLocation());
327 loser2.setLocation(door1.getLocation());
328 canvas.addSprite(fail);
329 }close braces end code blocks and must match an earlier open brace
330 ifif executes the next statement only if the condition in parenthesis evaluates to true(i ==this is the comparison operator which evaluates to true if both sides are the same 2)
331 {open braces start code blocks and must be matched with a close brace
332 loser2.setLocation(door2.getLocation());
333 winner.setLocation(door1.getLocation());
334 canvas.addSprite(win);
335 }close braces end code blocks and must match an earlier open brace
336 }close braces end code blocks and must match an earlier open brace
337 ifif executes the next statement only if the condition in parenthesis evaluates to true (doorpicked==this is the comparison operator which evaluates to true if both sides are the same2 &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 &&) notopen ==this is the comparison operator which evaluates to true if both sides are the same 3)
338 {open braces start code blocks and must be matched with a close brace
339 ifif executes the next statement only if the condition in parenthesis evaluates to true(i ==this is the comparison operator which evaluates to true if both sides are the same 1)
340 {open braces start code blocks and must be matched with a close brace
341 winner.setLocation(door2.getLocation());
342 loser2.setLocation(door3.getLocation());
343 canvas.addSprite(fail);
344
345 }close braces end code blocks and must match an earlier open brace
346 ifif executes the next statement only if the condition in parenthesis evaluates to true(i ==this is the comparison operator which evaluates to true if both sides are the same 2)
347 {open braces start code blocks and must be matched with a close brace
348 loser2.setLocation(door2.getLocation());
349 winner.setLocation(door3.getLocation());
350 canvas.addSprite(win);
351 }close braces end code blocks and must match an earlier open brace
352 }close braces end code blocks and must match an earlier open brace
353 ifif executes the next statement only if the condition in parenthesis evaluates to true (doorpicked==this is the comparison operator which evaluates to true if both sides are the same3 &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 &&) notopen ==this is the comparison operator which evaluates to true if both sides are the same 1)
354 {open braces start code blocks and must be matched with a close brace
355 ifif executes the next statement only if the condition in parenthesis evaluates to true(i ==this is the comparison operator which evaluates to true if both sides are the same 1)
356 {open braces start code blocks and must be matched with a close brace
357 winner.setLocation(door3.getLocation());
358 loser2.setLocation(door1.getLocation());
359 canvas.addSprite(fail);
360 }close braces end code blocks and must match an earlier open brace
361 ifif executes the next statement only if the condition in parenthesis evaluates to true(i ==this is the comparison operator which evaluates to true if both sides are the same 2)
362 {open braces start code blocks and must be matched with a close brace
363 loser2.setLocation(door3.getLocation());
364 winner.setLocation(door1.getLocation());
365 canvas.addSprite(win);
366 }close braces end code blocks and must match an earlier open brace
367 }close braces end code blocks and must match an earlier open brace
368 ifif executes the next statement only if the condition in parenthesis evaluates to true (doorpicked==this is the comparison operator which evaluates to true if both sides are the same3 &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 &&) notopen ==this is the comparison operator which evaluates to true if both sides are the same 2)
369 {open braces start code blocks and must be matched with a close brace
370 ifif executes the next statement only if the condition in parenthesis evaluates to true(i ==this is the comparison operator which evaluates to true if both sides are the same 1)
371 {open braces start code blocks and must be matched with a close brace
372 winner.setLocation(door3.getLocation());
373 loser2.setLocation(door2.getLocation());
374 canvas.addSprite(fail);
375 }close braces end code blocks and must match an earlier open brace
376 ifif executes the next statement only if the condition in parenthesis evaluates to true(i ==this is the comparison operator which evaluates to true if both sides are the same 2)
377 {open braces start code blocks and must be matched with a close brace
378 loser2.setLocation(door3.getLocation());
379 winner.setLocation(door2.getLocation());
380 canvas.addSprite(win);
381 }close braces end code blocks and must match an earlier open brace
382 }close braces end code blocks and must match an earlier open brace
383
384
385 canvas.removeSprite(door1);
386 canvas.removeSprite(door2);
387 canvas.removeSprite(door3);
388 canvas.addSprite(loser2);
389 canvas.addSprite(winner);
390 }close braces end code blocks and must match an earlier open brace
391 }close braces end code blocks and must match an earlier open brace
392 }close braces end code blocks and must match an earlier open brace
|