From ggc
|
001 packagepackage is used to name the directory or folder a class is in ChrisHull;
002
003 importimport means to make the classes and/or packages available in this program wiki.Wiki;
004 importimport means to make the classes and/or packages available in this program fang.*;
005 importimport means to make the classes and/or packages available in this program java.awt.*;
006 importimport means to make the classes and/or packages available in this program java.awt.geom.*;
007 importimport means to make the classes and/or packages available in this program Beta.*;
008
009 /**
010 * All about my game here.
011 * @authorthis is the Javadoc tag for documenting who created the source code Chull
012 */
013 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 Art extendsextends means to customize or extend the functionality of a class GameLoop
014 {open braces start code blocks and must be matched with a close brace
015 /**where the user clicks*/
016 privateprivate is used to restrict access to the current class only Point2D.Double whereClick;
017 /** Displays Title of Art*/
018 privateprivate is used to restrict access to the current class only Sprite Text;
019 /** Displays monster nose*/
020 privateprivate is used to restrict access to the current class only Sprite monsterNose;
021 /** Displays monster mouth*/
022 privateprivate is used to restrict access to the current class only Sprite monsterMouth;
023 /** Displays monster eye*/
024 privateprivate is used to restrict access to the current class only Sprite monsterEye;
025 /** Displays monster eye*/
026 privateprivate is used to restrict access to the current class only Sprite monsterEye2;
027 /** Moves the monsters face forfor is a looping structure for repeatedly executing a block of code translation*/
028 privateprivate is used to restrict access to the current class only Sprite moving;
029 /** determines type of tracker*/
030 privateprivate is used to restrict access to the current class only ProjectileTracker tracker;
031 /** Declares Track Statement*/
032 privateprivate is used to restrict access to the current class only OutlineTracker track;
033 /** Makes image rotate*/
034 privateprivate is used to restrict access to the current class only Sprite rotate;
035 /** Plays good sound*/
036 privateprivate is used to restrict access to the current class only Sound sound;
037 /** Plays bad sound*/
038 privateprivate is used to restrict access to the current class only Sound soundSecond;
039
040 /**sets up the game*/
041 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value startGame()
042 {open braces start code blocks and must be matched with a close brace
043 rotateSprite();
044 movingSprite();
045 makeSprites();
046 makeSounds();
047 addSprites();
048 scheduleRelative(newnew is used to create objects by calling the constructor NameAppear(), 1);
049 /** Changes the text in help file*/
050 setHelpText(
051 "Watch the moving shapes<br><br>"+adds two numbers together or concatenates Strings together
052 "press 1 and 2 to hear different sounds<br><br>"+adds two numbers together or concatenates Strings together
053 "Click Start to begin");
054
055 }close braces end code blocks and must match an earlier open brace
056
057
058 /** determines how the sprite will move*/
059 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value movingSprite()
060 {open braces start code blocks and must be matched with a close brace
061 moving=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite(Wiki.getMedia("Monstermouth.jpg"));
062 moving.setScale(0.3);
063 moving.setLocation(0.5, 1);
064 track=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OutlineTracker (.2, .5,.6 ,.5,.7);
065 track.setLooping(truetrue is the boolean value that is the opposite of false);
066 moving.setTracker(track);
067 moving.setLocation(track.getCurrentPoint());
068 canvas.addSprite(moving);
069
070 }close braces end code blocks and must match an earlier open brace
071
072 /**modifys monsterEye2 with a Periodic event*/
073 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value PeriodicEvent()
074 {open braces start code blocks and must be matched with a close brace
075 Sprite sprite=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite(Wiki.getMedia("Monstereye2.jpg"));
076 sprite.setScale(0.1);
077 sprite.setLocation(whereClick);
078 canvas.addSprite(sprite);
079
080 }close braces end code blocks and must match an earlier open brace
081
082
083 /**calls PeriodicEvent when the alarm goes off*/
084 classclass is a group of fields and methods used for making objects PeriodicEvent implementsimplements means providing method bodies for the methods declared in the corresponding interface Alarm
085 {open braces start code blocks and must be matched with a close brace
086 /**simply calls PerodicEvent*/
087 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value alarm()
088 {open braces start code blocks and must be matched with a close brace
089 monsterEye2.setVisible(!this is the not operator, which changes true to false and false to truemonsterEye2.isVisible());
090
091 scheduleRelative(thisthis means the current object (the implicit parameter),.5);
092
093 }close braces end code blocks and must match an earlier open brace
094 }close braces end code blocks and must match an earlier open brace
095
096
097 /**tells what sound will play*/
098 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makeSounds()
099 {open braces start code blocks and must be matched with a close brace
100 sound=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Sound(Wiki.getMedia("Ding.wav"));
101 soundSecond=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Sound(Wiki.getMedia("Boom.wav"));
102 }close braces end code blocks and must match an earlier open brace
103
104
105 /** determines what happens when you click*/
106 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value clickFirst()
107 {open braces start code blocks and must be matched with a close brace
108 Point2D.Double click=this assignment operator makes the left side equal to the right sidegetPlayer().getMouse().getClickLocation();
109 //did they click at all
110 ifif executes the next statement only if the condition in parenthesis evaluates to true(click!=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)
111 canvas.removeSprite(monsterEye);
112
113 }close braces end code blocks and must match an earlier open brace
114
115 /** determines how sprite will rotate*/
116 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value rotateSprite()
117 {open braces start code blocks and must be matched with a close brace
118 rotate=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite(Wiki.getMedia("Monsternose.jpg"));
119 rotate.setScale(0.1);
120 rotate.setLocation(0.5, 0.4);
121 Point2D.Double direction=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Point2D.Double(0, 0);
122 ProjectileTracker pTracker=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ProjectileTracker(direction);
123 pTracker.setAngularVelocity(1);
124 rotate.setTracker(pTracker);
125 canvas.addSprite(rotate);
126
127 }close braces end code blocks and must match an earlier open brace
128
129 /** displays the title of art and artist name*/
130 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value displayName()
131 {open braces start code blocks and must be matched with a close brace
132
133 Text=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Monster - Chris Hull");
134 Text.setScale(.4);
135 Text.setLocation(.5, .1);
136 canvas.addSprite(Text);
137 }close braces end code blocks and must match an earlier open brace
138
139
140 /** Sets up a alarm so artist name and title apears in 1 second*/
141 classclass is a group of fields and methods used for making objects NameAppear implementsimplements means providing method bodies for the methods declared in the corresponding interface Alarm
142 {open braces start code blocks and must be matched with a close brace
143 /** calls displayName*/
144 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value alarm()
145 {open braces start code blocks and must be matched with a close brace
146 displayName();
147 }close braces end code blocks and must match an earlier open brace
148 }close braces end code blocks and must match an earlier open brace
149
150
151 /**makes the sprites which composes the monsters face*/
152 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makeSprites()
153 {open braces start code blocks and must be matched with a close brace
154
155
156 monsterEye=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite(Wiki.getMedia("Monstereye.jpg"));
157 monsterEye.setScale(0.1);
158 monsterEye.setLocation(0.4, 0.3);
159
160 monsterEye2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite(Wiki.getMedia("Monstereye2.jpg"));
161 monsterEye2.setScale(0.1);
162 monsterEye2.setLocation(0.6, 0.3);
163
164
165 }close braces end code blocks and must match an earlier open brace
166
167 /**adds the sprites to the screen that belong to the monster*/
168 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value addSprites()
169
170 {open braces start code blocks and must be matched with a close brace
171
172 canvas.addSprite(monsterEye);
173 canvas.addSprite(monsterEye2);
174
175 }close braces end code blocks and must match an earlier open brace
176
177 /**handle input and game events*/
178 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 timePassed)
179 {open braces start code blocks and must be matched with a close brace
180 clickFirst();
181 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 same'1')
182 {open braces start code blocks and must be matched with a close brace
183 sound.play(0);
184 }close braces end code blocks and must match an earlier open brace
185 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 same'2')
186 {open braces start code blocks and must be matched with a close brace
187 soundSecond.play(1);
188 }close braces end code blocks and must match an earlier open brace
189 Point2D.Double click=this assignment operator makes the left side equal to the right sidegetPlayer().getMouse().getClickLocation();
190 ifif executes the next statement only if the condition in parenthesis evaluates to true(click!=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)
191 {open braces start code blocks and must be matched with a close brace
192 scheduleRelative(newnew is used to create objects by calling the constructor PeriodicEvent(), 1);
193 whereClick=this assignment operator makes the left side equal to the right sideclick;
194 }close braces end code blocks and must match an earlier open brace
195 }close braces end code blocks and must match an earlier open brace
196
197 }close braces end code blocks and must match an earlier open brace
|
Compiler Errors:
----------
1. ERROR in ChrisHull/Art.java (at line 32)
private OutlineTracker track;
^^^^^^^^^^^^^^
The type OutlineTracker is ambiguous
----------
2. ERROR in ChrisHull/Art.java (at line 61)
moving=new ImageSprite(Wiki.getMedia("Monstermouth.jpg"));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The constructor ImageSprite(URL) is undefined
----------
11 problems (11 errors)
Download/View ChrisHull/Art.java