|
001 packagepackage is used to name the directory or folder a class is in mcclarty;
002
003 importimport means to make the classes and/or packages available in this program fang.*;
004 importimport means to make the classes and/or packages available in this program java.awt.*;
005 importimport means to make the classes and/or packages available in this program java.awt.geom.*;
006
007 /**
008 * All about my game.
009 * @authorthis is the Javadoc tag for documenting who created the source code My Name Here
010 */
011 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 Interactive_Art extendsextends means to customize or extend the functionality of a class Game
012 {open braces start code blocks and must be matched with a close brace
013
014 privateprivate is used to restrict access to the current class only ImageSprite auron;
015 privateprivate is used to restrict access to the current class only ImageSprite seph;
016 privateprivate is used to restrict access to the current class only ImageSprite sun;
017 privateprivate is used to restrict access to the current class only ImageSprite choco;
018 privateprivate is used to restrict access to the current class only ImageSprite moogle;
019 privateprivate is used to restrict access to the current class only StringSprite title;
020 privateprivate is used to restrict access to the current class only StringSprite author;
021 privateprivate is used to restrict access to the current class only OutlineTransformer chocomov;
022 privateprivate is used to restrict access to the current class only Sound sword=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Sound("Shogun.wav");
023 privateprivate is used to restrict access to the current class only Sound ding=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Sound("DingLower.wav");
024
025 //*Sets up the game*/
026 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setup()
027 {open braces start code blocks and must be matched with a close brace
028 String helpText=this assignment operator makes the left side equal to the right side
029 "Press 'm' in order to make the moogle (small animal) blink.<br>"+adds two numbers together or concatenates Strings together
030
031 "Click on the chocobo (bird) to make it move across the screen.<br>"+adds two numbers together or concatenates Strings together
032
033 "Enjoy!";
034 setHelpText(helpText);
035 strings();
036 sun();
037 sephiroth();
038 auron();
039 moogle();
040 sound();
041 choco();
042
043 }close braces end code blocks and must match an earlier open brace
044 //* Plays a sword fighting sound throughout the duration of the program.*/
045 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value sound()
046 {open braces start code blocks and must be matched with a close brace
047 playSoundImmediately();
048 sword.setVolume(0.5);
049 sword.loop();
050 }close braces end code blocks and must match an earlier open brace
051 //* Places Sephiroth into the game and causes him to move about.*/
052 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value sephiroth()
053 {open braces start code blocks and must be matched with a close brace
054 seph=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("Seph.png");
055 seph.setSize(0.35);
056 addSprite(seph);
057
058 OutlineTransformer sephmov;
059 sephmov=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OutlineTransformer(0.45,0.1,0.5,0.45,0.5,0.35,0.35,0.1,0.5);
060 sephmov.setLooping(truetrue is the boolean value that is the opposite of false);
061 seph.addTransformer(sephmov);
062 seph.setLocation(sephmov.getCurrentPoint());
063 }close braces end code blocks and must match an earlier open brace
064 /** Places Auron on the screen and causes him to move mirroring Sephiroth's movements.*/
065 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value auron()
066 {open braces start code blocks and must be matched with a close brace
067 auron=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("Auron.jpg");
068 auron.setSize(0.25);
069 addSprite(auron);
070
071 OutlineTransformer auronmov;
072 auronmov=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OutlineTransformer(0.45,0.9,0.5,0.55,0.5,0.65,0.35,0.9,0.5);
073 auronmov.setLooping(truetrue is the boolean value that is the opposite of false);
074 auron.addTransformer(auronmov);
075 auron.setLocation(auronmov.getCurrentPoint());
076 }close braces end code blocks and must match an earlier open brace
077 /** Places the title and author on screen.*/
078 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value strings()
079 {open braces start code blocks and must be matched with a close brace
080 title=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Final Fantasy Art");
081 title.setSize(0.5);
082 title.setLocation(0.5,0.1);
083 title.setColor(Palette.getColor("Red"));
084 addSprite(title);
085
086 author=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("By: John McClarty");
087 author.setSize(0.25);
088 author.setLocation(0.5,0.95);
089 author.setColor(Palette.getColor("Red"));
090 addSprite(author);
091 }close braces end code blocks and must match an earlier open brace
092 //* Places moogle on screen and schedules a blinker to being when the 'w' key is pressed.*/
093 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value moogle()
094 {open braces start code blocks and must be matched with a close brace
095 moogle=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("Moogle.jpg");
096 moogle.setLocation(0.25,0.75);
097 moogle.setSize(0.25);
098 addSprite(moogle);
099 }close braces end code blocks and must match an earlier open brace
100
101 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value moogleAct()
102 {open braces start code blocks and must be matched with a close brace
103 ifif executes the next statement only if the condition in parenthesis evaluates to true (getKeyPressed() ==this is the comparison operator which evaluates to true if both sides are the same 'm')
104 {open braces start code blocks and must be matched with a close brace
105 schedule(newnew is used to create objects by calling the constructor Blinker(), 0.25);
106 playSoundImmediately();
107 ding.setVolume(0.5);
108
109 }close braces end code blocks and must match an earlier open brace
110 }close braces end code blocks and must match an earlier open brace
111
112 classclass is a group of fields and methods used for making objects Blinker extendsextends means to customize or extend the functionality of a class TimedAction
113 {open braces start code blocks and must be matched with a close brace
114 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value act()
115 {open braces start code blocks and must be matched with a close brace
116 booleanboolean is a type that is either true or false vis=this assignment operator makes the left side equal to the right sidemoogle.isVisible();
117 moogle.setVisible(!this is the not operator, which changes true to false and false to truevis);
118 schedule(thisthis means the current object (the implicit parameter),0.25);
119 }close braces end code blocks and must match an earlier open brace
120 }close braces end code blocks and must match an earlier open brace
121
122 //* Places a chocobo on screen and schedules him to move across screen when clicked on.*/
123 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value choco()
124 {open braces start code blocks and must be matched with a close brace
125 choco=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("Chocobo.jpg");
126 choco.setSize(0.25);
127 choco.setLocation(0.9,0.9);
128 addSprite(choco);
129
130 OutlineTransformer chocomov;
131 chocomov=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OutlineTransformer(0.05,0.9,0.9,0.1,0.9);
132 }close braces end code blocks and must match an earlier open brace
133 classclass is a group of fields and methods used for making objects DelayedResponse extendsextends means to customize or extend the functionality of a class TimedAction
134 {open braces start code blocks and must be matched with a close brace
135 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value act()
136 {open braces start code blocks and must be matched with a close brace
137 choco.addTransformer(chocomov);
138 }close braces end code blocks and must match an earlier open brace
139 }close braces end code blocks and must match an earlier open brace
140 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value chocoAct()
141 {open braces start code blocks and must be matched with a close brace
142 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 &this performs a bit-wise and (not the same as boolean and which is &&)&this performs a bit-wise and (not the same as boolean and which is &&) choco.intersects(getClick2D()))
143 {open braces start code blocks and must be matched with a close brace
144 schedule(newnew is used to create objects by calling the constructor DelayedResponse(), 1.5);
145 }close braces end code blocks and must match an earlier open brace
146 }close braces end code blocks and must match an earlier open brace
147
148 //* Places sun on screen and makes it move, blink, and spin.
149 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value sun()
150 {open braces start code blocks and must be matched with a close brace
151 sun=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("Mario-sun.jpg");
152 sun.setSize(0.15);
153 addSprite(sun);
154
155 OutlineTransformer sunmov;
156 sunmov=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OutlineTransformer(0.5,0.1,0.1,0.5,0.3,0.9,0.1,0.1,0.1);
157 sunmov.setLooping(truetrue is the boolean value that is the opposite of false);
158 sun.addTransformer(sunmov);
159 sun.setLocation(sunmov.getCurrentPoint());
160
161 Spinner sunspin;
162 sunspin=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Spinner(0);
163 sunspin.setRotationDegrees(360);
164 sun.addTransformer(sunspin);
165
166 schedule(newnew is used to create objects by calling the constructor Blinker2(), 0.25);
167 }close braces end code blocks and must match an earlier open brace
168 classclass is a group of fields and methods used for making objects Blinker2 extendsextends means to customize or extend the functionality of a class TimedAction
169 {open braces start code blocks and must be matched with a close brace
170 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value act()
171 {open braces start code blocks and must be matched with a close brace
172 booleanboolean is a type that is either true or false vis=this assignment operator makes the left side equal to the right sidesun.isVisible();
173 sun.setVisible(!this is the not operator, which changes true to false and false to truevis);
174 schedule(thisthis means the current object (the implicit parameter),0.25);
175 }close braces end code blocks and must match an earlier open brace
176 }close braces end code blocks and must match an earlier open brace
177
178 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value advance()
179 {open braces start code blocks and must be matched with a close brace
180 chocoAct();
181 moogleAct();
182 }close braces end code blocks and must match an earlier open brace
183 }close braces end code blocks and must match an earlier open brace
|