From FANG
|
01 packagepackage is used to name the directory or folder a class is in examples.levelSelect;
02
03 importimport means to make the classes and/or packages available in this program fang2.attributes.*;
04 importimport means to make the classes and/or packages available in this program fang2.core.*;
05 importimport means to make the classes and/or packages available in this program fang2.sprites.*;
06 importimport means to make the classes and/or packages available in this program fang2.transformers.*;
07
08 /**
09 * Level 1
10 * @authorthis is the Javadoc tag for documenting who created the source code Alex Park
11 * @authorthis is the Javadoc tag for documenting who created the source code modified by Jam when the
12 * FANG Engine was updated
13 */
14 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 Level1 extendsextends means to customize or extend the functionality of a class Game
15 {open braces start code blocks and must be matched with a close brace
16 /**Message to send to level*/
17 privateprivate is used to restrict access to the current class only String message;
18 /**
19 * Constructs a level with the string
20 * in the parameter.
21 * @paramthis is the Javadoc tag for documenting the purpose of parameters string The message
22 */
23 publicpublic is used to indicate unrestricted access (any other class can have access) Level1(String string)
24 {open braces start code blocks and must be matched with a close brace
25 message =this assignment operator makes the left side equal to the right side string;
26 }close braces end code blocks and must match an earlier open brace
27
28 /**
29 * makes and adds the sprite
30 */
31 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setup()
32 {open braces start code blocks and must be matched with a close brace
33 StringSprite sprite=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite(message);
34 sprite.setWidth(0.85);
35 sprite.setLocation(0.5, 0.5);
36 addSprite(sprite);
37 }close braces end code blocks and must match an earlier open brace
38
39 /**
40 * adds the next game when clicked
41 */
42 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value advance()
43 {open braces start code blocks and must be matched with a close brace
44 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)
45 {open braces start code blocks and must be matched with a close brace
46 addGame(newnew is used to create objects by calling the constructor LevelSelect());
47 finishGame();
48 }close braces end code blocks and must match an earlier open brace
49 }close braces end code blocks and must match an earlier open brace
50 }close braces end code blocks and must match an earlier open brace
51
52 //Uploaded on Sat Sep 19 13:57:59 EDT 2009
|
Download/View examples/levelSelect/Level1.java