From ggc
|
01 packagepackage is used to name the directory or folder a class is in Jam;
02
03 importimport means to make the classes and/or packages available in this program wiki.Wiki;
04 importimport means to make the classes and/or packages available in this program fang.*;
05 importimport means to make the classes and/or packages available in this program java.awt.*;
06 importimport means to make the classes and/or packages available in this program java.awt.geom.*;
07
08 /**
09 * All about my game here.
10 * @authorthis is the Javadoc tag for documenting who created the source code Jam Jenkins
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 WinLoseSpriteExample 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 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value startGame()
15 {open braces start code blocks and must be matched with a close brace
16 canvas.addSprite(getMessage("Java"));
17 //canvas.addSprite(getWinningSprite());
18 //canvas.addSprite(getLosingSprite());
19 }close braces end code blocks and must match an earlier open brace
20
21 privateprivate is used to restrict access to the current class only Sprite getMessage(String message)
22 {open braces start code blocks and must be matched with a close brace
23 StringSprite lose=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite(message);
24 lose.setScale(0.25);
25 lose.setLocation(0.5, 0.25);
26 returnreturn means to provide the result of the method and/or cease execution of the method immediately lose;
27 }close braces end code blocks and must match an earlier open brace
28
29 privateprivate is used to restrict access to the current class only Sprite getWinningSprite()
30 {open braces start code blocks and must be matched with a close brace
31 StringSprite lose=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Win");
32 lose.setScale(0.25);
33 lose.setLocation(0.5, 0.25);
34 returnreturn means to provide the result of the method and/or cease execution of the method immediately lose;
35 }close braces end code blocks and must match an earlier open brace
36
37 privateprivate is used to restrict access to the current class only Sprite getLosingSprite()
38 {open braces start code blocks and must be matched with a close brace
39 StringSprite lose=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Lose");
40 lose.setScale(0.25);
41 lose.setLocation(0.5, 0.25);
42 returnreturn means to provide the result of the method and/or cease execution of the method immediately lose;
43 }close braces end code blocks and must match an earlier open brace
44 }close braces end code blocks and must match an earlier open brace
|
Download/View Jam/WinLoseSpriteExample.java