From ggc
|
01 packagepackage is used to name the directory or folder a class is in Nick;
02
03 importimport means to make the classes and/or packages available in this program java.awt.Color;
04 importimport means to make the classes and/or packages available in this program java.awt.event.KeyEvent;
05 importimport means to make the classes and/or packages available in this program arcade.*;
06 importimport means to make the classes and/or packages available in this program fang.*;
07
08 /**
09 * This classclass is a group of fields and methods used for making objects simply launches the ArcadeGame.
10 * @authorthis is the Javadoc tag for documenting who created the source code Nick McKee
11 */
12 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 NickArcadeLauncher extendsextends means to customize or extend the functionality of a class GameLoop
13 {open braces start code blocks and must be matched with a close brace
14 privateprivate is used to restrict access to the current class only ArcadeGame topLevel;
15
16 /**
17 * sets the level at which to start
18 */
19 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value startGame()
20 {open braces start code blocks and must be matched with a close brace
21 topLevel=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor NickArcade();
22 topLevel.setName("Nick's Arcade");
23 setNextLevel(topLevel);
24
25 StringSprite toFinish=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Press ESC\nto end game");
26 toFinish.rightJustify();
27 toFinish.bottomJustify();
28 toFinish.setScale(0.2);
29 toFinish.setLocation(0.98, 0.98);
30 toFinish.setColor(newnew is used to create objects by calling the constructor Color(255, 255, 0, 64));
31 canvas.addSprite(toFinish);
32 topLevel.persist(toFinish);
33 }close braces end code blocks and must match an earlier open brace
34
35 /**
36 * enables the Escape key to finish the level at any time
37 */
38 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value advanceFrame(doubledouble is the type for numbers that can contain decimal fractions timeElapsed)
39 {open braces start code blocks and must be matched with a close brace
40 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 sameKeyEvent.VK_ESCAPE)
41 finishLevel();
42 ifif executes the next statement only if the condition in parenthesis evaluates to true(getLevelNumber()==this is the comparison operator which evaluates to true if both sides are the same0)
43 setNextLevel(topLevel);
44 }close braces end code blocks and must match an earlier open brace
45
46 /**
47 * runs the game as an application
48 * @paramthis is the Javadoc tag for documenting the purpose of parameters args not used
49 */
50 publicpublic is used to indicate unrestricted access (any other class can have access) staticstatic means that an instance is not required for access (class level access) voidvoid means the method does not return a value mainThe main method is the place where applications begin executing.(String[brackets are typically used to declare, initialize and index (indicate which element of) arrays]brackets are typically used to declare, initialize and index (indicate which element of) arrays args)
51 {open braces start code blocks and must be matched with a close brace
52 newnew is used to create objects by calling the constructor ArcadeLauncher().runAsApplication();
53 }close braces end code blocks and must match an earlier open brace
54 }close braces end code blocks and must match an earlier open brace
|
Download/View Nick/NickArcadeLauncher.java