|
001 packagepackage is used to name the directory or folder a class is in Curtis;
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 fang.*;
007 importimport means to make the classes and/or packages available in this program java.awt.*;
008 importimport means to make the classes and/or packages available in this program java.awt.geom.*;
009
010 /**
011 * Classic Arkanoid.
012 * @authorthis is the Javadoc tag for documenting who created the source code Curtis St. John
013 */
014 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 Arkanoid extendsextends means to customize or extend the functionality of a class Game
015 {open braces start code blocks and must be matched with a close brace
016 privateprivate is used to restrict access to the current class only RectangleSprite block;
017 privateprivate is used to restrict access to the current class only ArrayList<Sprite> allBlocks;
018 privateprivate is used to restrict access to the current class only OutlineSprite paddle, wall1, wall2, wall3;
019 privateprivate is used to restrict access to the current class only OvalSprite ball, ball2, rnd1, rnd2;
020 privateprivate is used to restrict access to the current class only ArrayList<Sprite> redBullet;
021 privateprivate is used to restrict access to the current class only ProjectileTransformer projectile, projectile2, bulletTransformer;
022 privateprivate is used to restrict access to the current class only StringSprite lives, score, youWin, gameOver;
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 blocksLeft, startlives;
024
025 /**sets up the game*/
026 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setup()
027 {open braces start code blocks and must be matched with a close brace
028 helpScreen();
029 blocks();
030 ball();
031 paddle();
032 walls();
033 roundWalls();
034 lives();
035 score();
036 redBullet=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ArrayList<Sprite>();
037
038 projectile=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ProjectileTransformer(.1, .25);
039 projectile2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ProjectileTransformer(.2, .25);
040 ball.setTracker(projectile);
041 ball2.setTracker(projectile2);
042
043 }close braces end code blocks and must match an earlier open brace
044
045 /**The Help Screen*/
046 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value helpScreen()
047 {open braces start code blocks and must be matched with a close brace
048 String helpText=this assignment operator makes the left side equal to the right side
049 "Use The Mouse<br>"+adds two numbers together or concatenates Strings together
050 "To Move<br>"+adds two numbers together or concatenates Strings together
051 "Right Click To Shoot<br>"+adds two numbers together or concatenates Strings together
052 "Shooting the ball<br>"+adds two numbers together or concatenates Strings together
053 "Adds an extra ball...<br>"+adds two numbers together or concatenates Strings together
054 "Only works ONCE!<br>"+adds two numbers together or concatenates Strings together
055 "By the way keep track of the<br>"+adds two numbers together or concatenates Strings together
056 "Original ball. Extra one doesn't come back";
057 setHelpText(helpText);
058 }close braces end code blocks and must match an earlier open brace
059
060 /**Makes the blocks*/
061 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value blocks()
062 {open braces start code blocks and must be matched with a close brace
063 allBlocks=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ArrayList<Sprite>();
064 intint is the type for whole numbers and it is short for integer blockshoriz=this assignment operator makes the left side equal to the right side11;
065 intint is the type for whole numbers and it is short for integer blocksvert=this assignment operator makes the left side equal to the right side4;
066 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<blocksvert; j++this is the increment operator, which increases the variable by 1)
067 {open braces start code blocks and must be matched with a close brace
068 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 sideblockshoriz; i++this is the increment operator, which increases the variable by 1)
069 {open braces start code blocks and must be matched with a close brace
070 block=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor RectangleSprite(2, 1);
071 block.setSize(.9/blockshoriz);
072 doubledouble is the type for numbers that can contain decimal fractions x=this assignment operator makes the left side equal to the right side.5/blockshoriz+adds two numbers together or concatenates Strings together1.0/blockshoriz*(i-1);
073 doubledouble is the type for numbers that can contain decimal fractions y=this assignment operator makes the left side equal to the right side.5/blockshoriz+adds two numbers together or concatenates Strings together(j+adds two numbers together or concatenates Strings together0.0)/blockshoriz;
074 block.setLocation(x, y);
075 block.setColor(getColor("white"));
076 addSprite(block);
077 allBlocks.add(block);
078 }close braces end code blocks and must match an earlier open brace
079 }close braces end code blocks and must match an earlier open brace
080 }close braces end code blocks and must match an earlier open brace
081 /**Makes the balls*/
082 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value ball()
083 {open braces start code blocks and must be matched with a close brace
084 ball=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite(1, 1);
085 ball.setSize(.03);
086 ball.setLocation(.7, .5);
087 ball.setColor(getColor("lime green"));
088 addSprite(ball);
089
090 ball2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite(1, 1);
091 ball2.setSize(.03);
092 ball2.setLocation(.7, .6);
093 ball2.setColor(getColor("lime green"));
094 ball2.setVisible(falsefalse is a value for the boolean type and means not true);
095 }close braces end code blocks and must match an earlier open brace
096 /**Makes the paddle*/
097 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value paddle()
098 {open braces start code blocks and must be matched with a close brace
099 paddle=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OutlineSprite(newnew is used to create objects by calling the constructor LineSprite(0, 0, 1, 0));
100 paddle.setSize(.25);
101 paddle.setLineThickness(.1);
102 paddle.setLocation(.5, .9);
103 paddle.setColor(getColor("yellow"));
104 addSprite(paddle);
105 }close braces end code blocks and must match an earlier open brace
106 /**Makes straight walls*/
107 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value walls()
108 {open braces start code blocks and must be matched with a close brace
109 wall1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OutlineSprite(newnew is used to create objects by calling the constructor LineSprite(0, 0, 0, 1));
110 wall1.setSize(2);
111 wall1.setLocation(0, 0);
112 wall1.setColor(getColor("magenta"));
113 addSprite(wall1);
114
115 wall2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OutlineSprite(newnew is used to create objects by calling the constructor LineSprite(0, 0, 0, 1));
116 wall2.setSize(2);
117 wall2.setLocation(1, 0);
118 wall2.setColor(getColor("magenta"));
119 addSprite(wall2);
120
121 wall3=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OutlineSprite(newnew is used to create objects by calling the constructor LineSprite(0, 0, 1, 0));
122 wall3.setSize(2);
123 wall3.setLocation(0, 0);
124 wall3.setColor(getColor("magenta"));
125 addSprite(wall3);
126 }close braces end code blocks and must match an earlier open brace
127 /**Makes the round wall forfor is a looping structure for repeatedly executing a block of code extra difficulty*/
128 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value roundWalls()
129 {open braces start code blocks and must be matched with a close brace
130 rnd1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite(1, 1);
131 rnd1.setSize(.2);
132 rnd1.setLocation(1, .6);
133 addSprite(rnd1);
134
135 rnd2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite(1, 1);
136 rnd2.setSize(.2);
137 rnd2.setLocation(0, .6);
138 addSprite(rnd2);
139 }close braces end code blocks and must match an earlier open brace
140
141 /**Makes paddle move*/
142 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value movePaddle()
143 {open braces start code blocks and must be matched with a close brace
144 paddle.setX(getMouseX());
145 }close braces end code blocks and must match an earlier open brace
146 /**What the ball can bounce off of*/
147 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value moveBall()
148 {open braces start code blocks and must be matched with a close brace
149 ball.bounceOffOf(paddle);
150 ball.bounceOffOf(wall1);
151 ball.bounceOffOf(wall2);
152 ball.bounceOffOf(wall3);
153 ball.bounceOffOf(rnd1);
154 ball.bounceOffOf(rnd2);
155
156 ball2.bounceOffOf(paddle);
157 ball2.bounceOffOf(wall1);
158 ball2.bounceOffOf(wall2);
159 ball2.bounceOffOf(wall3);
160 ball2.bounceOffOf(rnd1);
161 ball2.bounceOffOf(rnd2);
162 }close braces end code blocks and must match an earlier open brace
163 /**Handles the bulletts*/
164 privateprivate is used to restrict access to the current class only Sprite getAvailableBullet()
165 {open braces start code blocks and must be matched with a close brace
166 forfor is a looping structure for repeatedly executing a block of code(Sprite single: redBullet)
167 {open braces start code blocks and must be matched with a close brace
168 ifif executes the next statement only if the condition in parenthesis evaluates to true(single.isVisible()==this is the comparison operator which evaluates to true if both sides are the samefalsefalse is a value for the boolean type and means not true)
169 {open braces start code blocks and must be matched with a close brace
170 returnreturn means to provide the result of the method and/or cease execution of the method immediately single;
171 }close braces end code blocks and must match an earlier open brace
172 ifif executes the next statement only if the condition in parenthesis evaluates to true(single.getLocation().y<0)
173 {open braces start code blocks and must be matched with a close brace
174 returnreturn means to provide the result of the method and/or cease execution of the method immediately single;
175 }close braces end code blocks and must match an earlier open brace
176 }close braces end code blocks and must match an earlier open brace
177
178 Sprite bullet=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(3);
179 bullet.setSize(0.05);
180 bullet.setVisible(falsefalse is a value for the boolean type and means not true);
181 bullet.setColor(getColor("red"));
182
183 ProjectileTransformer bulletTransformer=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ProjectileTransformer(0, -0.2);
184 bullet.addTransformer(bulletTransformer);
185
186 addSprite(bullet);
187 redBullet.add(bullet);
188
189 returnreturn means to provide the result of the method and/or cease execution of the method immediately bullet;
190 }close braces end code blocks and must match an earlier open brace
191 /**Makes the "You Win" text*/
192 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value victory()
193 {open braces start code blocks and must be matched with a close brace
194 youWin=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("You Win!");
195 youWin.setSize(1);
196 youWin.setLocation(.5, .8);
197 addSprite(youWin);
198 }close braces end code blocks and must match an earlier open brace
199
200 /**Makes the "Game Over" text*/
201 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value failure()
202 {open braces start code blocks and must be matched with a close brace
203 gameOver=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Game Over");
204 gameOver.setSize(1);
205 gameOver.setLocation(.5, .8);
206 addSprite(gameOver);
207 setLives(0);
208 }close braces end code blocks and must match an earlier open brace
209
210 /**Makes "you win" text flash different colors*/
211 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value randomColorBound()
212 {open braces start code blocks and must be matched with a close brace
213 youWin.setColor(newnew is used to create objects by calling the constructor Color(random.nextInt()));
214 }close braces end code blocks and must match an earlier open brace
215
216 /**Allows you to shoot by clicking*/
217 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value paddleShoot()
218 {open braces start code blocks and must be matched with a close brace
219 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)
220 {open braces start code blocks and must be matched with a close brace
221 Sprite available=this assignment operator makes the left side equal to the right sidegetAvailableBullet();
222 available.setLocation(paddle.getX(), paddle.getY()-paddle.getSize()/2);
223 available.setVisible(truetrue is the boolean value that is the opposite of false);
224
225 }close braces end code blocks and must match an earlier open brace
226 }close braces end code blocks and must match an earlier open brace
227
228 /**Shooting Blocks +adds two numbers together or concatenates Strings together 5 score*/
229 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value handleBulletblockCollision()
230 {open braces start code blocks and must be matched with a close brace
231 forfor is a looping structure for repeatedly executing a block of code(Sprite single: allBlocks)
232 {open braces start code blocks and must be matched with a close brace
233 forfor is a looping structure for repeatedly executing a block of code(Sprite bullet: redBullet)
234 {open braces start code blocks and must be matched with a close brace
235 ifif executes the next statement only if the condition in parenthesis evaluates to true(single.isVisible() &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 &&) bullet.isVisible() &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 &&) single.intersects(bullet))
236 {open braces start code blocks and must be matched with a close brace
237 single.setVisible(falsefalse is a value for the boolean type and means not true);
238 bullet.setVisible(falsefalse is a value for the boolean type and means not true);
239
240 intint is the type for whole numbers and it is short for integer startscore =this assignment operator makes the left side equal to the right side getScore();
241 setScore(startscore+adds two numbers together or concatenates Strings together5);
242 score.setText("Score:"+adds two numbers together or concatenates Strings togethergetScore());
243 }close braces end code blocks and must match an earlier open brace
244 }close braces end code blocks and must match an earlier open brace
245 }close braces end code blocks and must match an earlier open brace
246 }close braces end code blocks and must match an earlier open brace
247
248 /**Handles the 1st ball hitting blocks +adds two numbers together or concatenates Strings together 10 score*/
249 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value handleBallblockCollision()
250 {open braces start code blocks and must be matched with a close brace
251 forfor is a looping structure for repeatedly executing a block of code(Sprite single: allBlocks)
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(single.isVisible()==this is the comparison operator which evaluates to true if both sides are the same truetrue is the boolean value that is the opposite of false &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 &&) single.intersects(ball))
254 {open braces start code blocks and must be matched with a close brace
255 ball.bounceOffOf(single);
256
257 single.setVisible(falsefalse is a value for the boolean type and means not true);
258
259 intint is the type for whole numbers and it is short for integer startscore =this assignment operator makes the left side equal to the right side getScore();
260 setScore(startscore+adds two numbers together or concatenates Strings together10);
261 score.setText("Score:"+adds two numbers together or concatenates Strings togethergetScore());
262 }close braces end code blocks and must match an earlier open brace
263 }close braces end code blocks and must match an earlier open brace
264 }close braces end code blocks and must match an earlier open brace
265
266 /**Handles the 2nd ball hitting blocks +adds two numbers together or concatenates Strings together 10 score*/
267 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value handleBall2blockCollision()
268 {open braces start code blocks and must be matched with a close brace
269 forfor is a looping structure for repeatedly executing a block of code(Sprite single: allBlocks)
270 {open braces start code blocks and must be matched with a close brace
271 ifif executes the next statement only if the condition in parenthesis evaluates to true(single.isVisible()==this is the comparison operator which evaluates to true if both sides are the same truetrue is the boolean value that is the opposite of false &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 &&) single.intersects(ball2))
272 {open braces start code blocks and must be matched with a close brace
273 ball2.bounceOffOf(single);
274
275 single.setVisible(falsefalse is a value for the boolean type and means not true);
276
277 intint is the type for whole numbers and it is short for integer startscore =this assignment operator makes the left side equal to the right side getScore();
278 setScore(startscore+adds two numbers together or concatenates Strings together10);
279 score.setText("Score:"+adds two numbers together or concatenates Strings togethergetScore());
280 }close braces end code blocks and must match an earlier open brace
281 }close braces end code blocks and must match an earlier open brace
282 }close braces end code blocks and must match an earlier open brace
283
284 /**Counts how many blocks are left*/
285 privateprivate is used to restrict access to the current class only intint is the type for whole numbers and it is short for integer blockCount()
286 {open braces start code blocks and must be matched with a close brace
287 blocksLeft =this assignment operator makes the left side equal to the right side 0;
288 forfor is a looping structure for repeatedly executing a block of code(Sprite single : allBlocks)
289 {open braces start code blocks and must be matched with a close brace
290 ifif executes the next statement only if the condition in parenthesis evaluates to true(single.isVisible() ==this is the comparison operator which evaluates to true if both sides are the same truetrue is the boolean value that is the opposite of false)
291 blocksLeft++this is the increment operator, which increases the variable by 1;
292 }close braces end code blocks and must match an earlier open brace
293 returnreturn means to provide the result of the method and/or cease execution of the method immediately blocksLeft;
294 }close braces end code blocks and must match an earlier open brace
295
296 /**Handles the ball hitting the bullet and giving extra ball*/
297 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value handleBallBulletCollision()
298 {open braces start code blocks and must be matched with a close brace
299 forfor is a looping structure for repeatedly executing a block of code(Sprite bullet: redBullet)
300 {open braces start code blocks and must be matched with a close brace
301 ifif executes the next statement only if the condition in parenthesis evaluates to true(ball.isVisible() &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 &&) bullet.isVisible() &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 &&) ball.intersects(bullet))
302 {open braces start code blocks and must be matched with a close brace
303 ball2.setVisible(truetrue is the boolean value that is the opposite of false);
304 addSprite(ball2);
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 }close braces end code blocks and must match an earlier open brace
308
309 /**Displays lives*/
310 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value lives()
311 {open braces start code blocks and must be matched with a close brace
312 setLives(3);
313 lives=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Lives:"+adds two numbers together or concatenates Strings togethergetLives());
314 lives.setLocation(0.1, 0.95);
315 lives.setSize(0.15);
316 lives.leftJustify();
317 lives.setColor(getColor("white"));
318 addSprite(lives);
319 }close braces end code blocks and must match an earlier open brace
320
321 /**Losing a life*/
322 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value losing()
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(ball.getLocation().y>1 &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 &&) ball2.isVisible() ==this is the comparison operator which evaluates to true if both sides are the samefalsefalse is a value for the boolean type and means not true)
325 {open braces start code blocks and must be matched with a close brace
326 startlives =this assignment operator makes the left side equal to the right side getLives();
327 setLives(startlives-1);
328 lives.setText("Lives:"+adds two numbers together or concatenates Strings togethergetLives());
329
330 ball.setLocation(.4, .6);
331 }close braces end code blocks and must match an earlier open brace
332 ifif executes the next statement only if the condition in parenthesis evaluates to true(ball.getLocation().y>1 &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 &&) ball2.isVisible())
333 {open braces start code blocks and must be matched with a close brace
334 ball.setVisible(falsefalse is a value for the boolean type and means not true);
335 }close braces end code blocks and must match an earlier open brace
336
337 ifif executes the next statement only if the condition in parenthesis evaluates to true(ball2.getLocation().y>1 &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 &&) ball.isVisible() ==this is the comparison operator which evaluates to true if both sides are the samefalsefalse is a value for the boolean type and means not true)
338 {open braces start code blocks and must be matched with a close brace
339 startlives =this assignment operator makes the left side equal to the right side getLives();
340 setLives(startlives-1);
341 lives.setText("Lives:"+adds two numbers together or concatenates Strings togethergetLives());
342 ball.setLocation(.4, .6);
343 ball.setVisible(truetrue is the boolean value that is the opposite of false);
344 }close braces end code blocks and must match an earlier open brace
345
346 ifif executes the next statement only if the condition in parenthesis evaluates to true(ball2.getLocation().y>1 &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 &&) ball.isVisible())
347 {open braces start code blocks and must be matched with a close brace
348 ball2.setVisible(falsefalse is a value for the boolean type and means not true);
349 }close braces end code blocks and must match an earlier open brace
350 ifif executes the next statement only if the condition in parenthesis evaluates to true (getLives()<1)
351 {open braces start code blocks and must be matched with a close brace
352 failure();
353 paddle.setVisible(falsefalse is a value for the boolean type and means not true);
354 }close braces end code blocks and must match an earlier open brace
355 }close braces end code blocks and must match an earlier open brace
356
357 /**Display score*/
358 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value score()
359 {open braces start code blocks and must be matched with a close brace
360 setScore(0);
361 score=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite ("Score:"+adds two numbers together or concatenates Strings togethergetScore());
362 score.setLocation(0.7, 0.95);
363 score.setSize(0.15);
364 score.setColor(getColor("white"));
365 score.rightJustify();
366 addSprite(score);
367 }close braces end code blocks and must match an earlier open brace
368
369 /**handle input and game events*/
370 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value advance()
371 {open braces start code blocks and must be matched with a close brace
372 movePaddle();
373 moveBall();
374 paddleShoot();
375 handleBulletblockCollision();
376 handleBallblockCollision();
377 handleBall2blockCollision();
378 handleBallBulletCollision();
379
380 ifif executes the next statement only if the condition in parenthesis evaluates to true(getLives()>0 &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 &&) blockCount()>0)
381 {open braces start code blocks and must be matched with a close brace
382 losing();
383 }close braces end code blocks and must match an earlier open brace
384
385 /**Displays victory text when you run out of blocks*/
386 ifif executes the next statement only if the condition in parenthesis evaluates to true(blockCount()<=this evaluates to true if the left side is not more than the right side0)
387 {open braces start code blocks and must be matched with a close brace
388 victory();
389 randomColorBound();
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
|