From FANG
|
01 packagepackage is used to name the directory or folder a class is in examples.splash;
02 //start auto-imports
03 //end auto-imports
04
05 importimport means to make the classes and/or packages available in this program fang2.attributes.*;
06 importimport means to make the classes and/or packages available in this program fang2.core.*;
07 importimport means to make the classes and/or packages available in this program fang2.sprites.*;
08 importimport means to make the classes and/or packages available in this program fang2.transformers.*;
09
10 /**Displays the words Game Over indefinitely.
11 * @authornull Jam Jenkins
12 */
13 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 GameOverSplash extendsextends means to customize or extend the functionality of a class Game
14 {open braces start code blocks and must be matched with a close brace
15 /**
16 * makes and adds a sprite which says
17 * Game Over
18 */
19 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setup()
20 {open braces start code blocks and must be matched with a close brace
21 StringSprite sprite=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite(
22 "Game Over\n\n"+adds two numbers together or concatenates Strings together
23 "Press any key\n"+adds two numbers together or concatenates Strings together
24 "to start over.");
25 sprite.setWidth(0.85);
26 sprite.setLocation(0.5, 0.5);
27 addSprite(sprite);
28 }close braces end code blocks and must match an earlier open brace
29
30 /**
31 * waits forfor is a looping structure for repeatedly executing a block of code the user to click
32 * before advancing to the next level
33 */
34 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value advance()
35 {open braces start code blocks and must be matched with a close brace
36 ifif executes the next statement only if the condition in parenthesis evaluates to true(keyPressed())
37 {open braces start code blocks and must be matched with a close brace
38 addGame(newnew is used to create objects by calling the constructor ActualGameLevel("Game Here"));
39 finishGame();
40 }close braces end code blocks and must match an earlier open brace
41 }close braces end code blocks and must match an earlier open brace
42
43 }close braces end code blocks and must match an earlier open brace
44
45 //Uploaded on Sat Sep 19 13:58:16 EDT 2009
|
Download/View examples/splash/GameOverSplash.java