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 fang.*;
04 importimport means to make the classes and/or packages available in this program wiki.Wiki;
05 /**
06 * All about my classclass is a group of fields and methods used for making objects here.
07 * @authorthis is the Javadoc tag for documenting who created the source code Jam Jenkins
08 */
09 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 GameState
10 {open braces start code blocks and must be matched with a close brace
11 privateprivate is used to restrict access to the current class only intint is the type for whole numbers and it is short for integer gold;
12 privateprivate is used to restrict access to the current class only intint is the type for whole numbers and it is short for integer life;
13 privateprivate is used to restrict access to the current class only StringSprite goldSprite;
14 privateprivate is used to restrict access to the current class only StringSprite lifeSprite;
15
16 publicpublic is used to indicate unrestricted access (any other class can have access) GameState()
17 {open braces start code blocks and must be matched with a close brace
18 gold=this assignment operator makes the left side equal to the right side0;
19 life=this assignment operator makes the left side equal to the right side3;
20 goldSprite=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Gold: "+adds two numbers together or concatenates Strings togethergold);
21 goldSprite.rightJustify();
22 goldSprite.topJustify();
23 goldSprite.setLocation(0.95, 0.05);
24 goldSprite.setWidth(0.4);
25 lifeSprite=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Life: "+adds two numbers together or concatenates Strings togetherlife);
26 lifeSprite.leftJustify();
27 lifeSprite.topJustify();
28 lifeSprite.setLocation(0.05, 0.05);
29 lifeSprite.setWidth(0.4);
30 }close braces end code blocks and must match an earlier open brace
31
32 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setLife(intint is the type for whole numbers and it is short for integer life)
33 {open braces start code blocks and must be matched with a close brace
34 thisthis means the current object (the implicit parameter).life=this assignment operator makes the left side equal to the right sidelife;
35 lifeSprite.setText("Life: "+adds two numbers together or concatenates Strings togetherlife);
36 }close braces end code blocks and must match an earlier open brace
37
38 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setGold(intint is the type for whole numbers and it is short for integer gold)
39 {open braces start code blocks and must be matched with a close brace
40 thisthis means the current object (the implicit parameter).gold=this assignment operator makes the left side equal to the right sidegold;
41 goldSprite.setText("Gold: "+adds two numbers together or concatenates Strings togethergold);
42 }close braces end code blocks and must match an earlier open brace
43
44 publicpublic is used to indicate unrestricted access (any other class can have access) intint is the type for whole numbers and it is short for integer getLife()
45 {open braces start code blocks and must be matched with a close brace
46 returnreturn means to provide the result of the method and/or cease execution of the method immediately life;
47 }close braces end code blocks and must match an earlier open brace
48
49 publicpublic is used to indicate unrestricted access (any other class can have access) intint is the type for whole numbers and it is short for integer getGold()
50 {open braces start code blocks and must be matched with a close brace
51 returnreturn means to provide the result of the method and/or cease execution of the method immediately gold;
52 }close braces end code blocks and must match an earlier open brace
53
54 publicpublic is used to indicate unrestricted access (any other class can have access) StringSprite getGoldSprite()
55 {open braces start code blocks and must be matched with a close brace
56 returnreturn means to provide the result of the method and/or cease execution of the method immediately goldSprite;
57 }close braces end code blocks and must match an earlier open brace
58
59 publicpublic is used to indicate unrestricted access (any other class can have access) StringSprite getLifeSprite()
60 {open braces start code blocks and must be matched with a close brace
61 returnreturn means to provide the result of the method and/or cease execution of the method immediately lifeSprite;
62 }close braces end code blocks and must match an earlier open brace
63
64 }close braces end code blocks and must match an earlier open brace
|
Download/View jam/GameState.java