From ggc
|
01 packagepackage is used to name the directory or folder a class is in Merima.arcade;
02 importimport means to make the classes and/or packages available in this program java.awt.Color;
03 importimport means to make the classes and/or packages available in this program java.awt.event.KeyEvent;
04 importimport means to make the classes and/or packages available in this program arcade.*;
05 importimport means to make the classes and/or packages available in this program fang.*;
06
07 /**
08 * This classclass is a group of fields and methods used for making objects simply launches the ArcadeGame.
09 * @authorthis is the Javadoc tag for documenting who created the source code Merima Omanovic
10 */
11 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 ArcadeGamesLauncher extendsextends means to customize or extend the functionality of a class GameLoop
12 {open braces start code blocks and must be matched with a close brace
13 privateprivate is used to restrict access to the current class only ArcadeGame topLevel;
14
15 /**
16 * sets the level at which to start
17 */
18 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value startGame()
19 {open braces start code blocks and must be matched with a close brace
20 topLevel=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ArcadeGames();
21 topLevel.setName("Merima's Arcade Games");
22 setNextLevel(topLevel);
23
24 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");
25 toFinish.rightJustify();
26 toFinish.bottomJustify();
27 toFinish.setScale(0.2);
28 toFinish.setLocation(0.98, 0.98);
29 toFinish.setColor(newnew is used to create objects by calling the constructor Color(255, 255, 0, 64));
30 canvas.addSprite(toFinish);
31 topLevel.persist(toFinish);
32 }close braces end code blocks and must match an earlier open brace
33
34 /**
35 * enables the Escape key to finish the level at any time
36 */
37 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)
38 {open braces start code blocks and must be matched with a close brace
39 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)
40 finishLevel();
41 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)
42 setNextLevel(topLevel);
43 }close braces end code blocks and must match an earlier open brace
44
45 /**
46 * runs the game as an application
47 * @paramthis is the Javadoc tag for documenting the purpose of parameters args not used
48 */
49 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)
50 {open braces start code blocks and must be matched with a close brace
51 newnew is used to create objects by calling the constructor ArcadeLauncher().runAsApplication();
52 }close braces end code blocks and must match an earlier open brace
53 }close braces end code blocks and must match an earlier open brace
|
Download/View Merima/arcade/ArcadeGamesLauncher.java