|
001 importimport means to make the classes and/or packages available in this program fang.*;
002 importimport means to make the classes and/or packages available in this program java.awt.*;
003 importimport means to make the classes and/or packages available in this program java.awt.geom.*;
004 importimport means to make the classes and/or packages available in this program java.awt.Color;
005
006 /**
007 * I did my best to make a face.
008 * @authorthis is the Javadoc tag for documenting who created the source code Steven Pingel
009 */
010 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 Assignment_3 extendsextends means to customize or extend the functionality of a class GameLoop
011 {open braces start code blocks and must be matched with a close brace
012 /**an Image of Fire**/
013 privateprivate is used to restrict access to the current class only Sprite image;
014
015 /**an circle*/
016 privateprivate is used to restrict access to the current class only Sprite oval;
017
018 /**an oval*/
019 privateprivate is used to restrict access to the current class only Sprite oval1;
020
021 /**a rectangle*/
022 privateprivate is used to restrict access to the current class only Sprite rectangle;
023
024 /**the Image on the Nose*/
025 privateprivate is used to restrict access to the current class only Sprite image1;
026
027 /**the left eyebrow/pie*/
028 privateprivate is used to restrict access to the current class only Sprite pie;
029
030 /**the right eyebrow/pie*/
031 privateprivate is used to restrict access to the current class only Sprite pie1;
032
033 /**the left eye/polygon*/
034 privateprivate is used to restrict access to the current class only Sprite polygon;
035
036 /**the right eye/polygon*/
037 privateprivate is used to restrict access to the current class only Sprite polygon1;
038
039 /**the left ear/arc*/
040 privateprivate is used to restrict access to the current class only Sprite arc;
041
042 /**the right ear/arc*/
043 privateprivate is used to restrict access to the current class only Sprite arc1;
044
045 /**the title*/
046 privateprivate is used to restrict access to the current class only Sprite title;
047
048 /**my name*/
049 privateprivate is used to restrict access to the current class only Sprite name;
050
051 /**the left pupil*/
052 privateprivate is used to restrict access to the current class only Sprite pupil;
053
054 /**the right pupil*/
055 privateprivate is used to restrict access to the current class only Sprite pupil1;
056
057 /**the hat*/
058 privateprivate is used to restrict access to the current class only Sprite rectangle1;
059
060 /**the right line*/
061 privateprivate is used to restrict access to the current class only Sprite line;
062
063 /**the left line*/
064 privateprivate is used to restrict access to the current class only Sprite line1;
065
066 /**sets up the game*/
067 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value startGame()
068 {open braces start code blocks and must be matched with a close brace
069 makeSprites();
070 addSprites();
071 }close braces end code blocks and must match an earlier open brace
072
073 /**makes the sprites*/
074 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makeSprites()
075 {open braces start code blocks and must be matched with a close brace
076 image=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("Fire.jpg");
077 image.setSize(1.25);
078 image.setLocation(0.5, 0.5);
079
080 oval=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite(3, 3);
081 oval.setScale(0.75);
082 oval.setLocation(0.5, 0.5);
083
084 oval1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite(3, 1);
085 oval1.setColor(Palette.getColor("Midnight Blue"));
086 oval1.setScale(0.50);
087 oval1.setLocation(0.5, 0.75);
088
089 rectangle=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor RectangleSprite(1, 1);
090 rectangle.setColor(Palette.getColor("Maroon"));
091 rectangle.setSize(.15);
092 rectangle.setLocation(0.5, 0.5);
093
094 image1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("Busa.jpg");
095 image1.setSize(.1);
096 image1.setLocation(0.5, 0.5);
097
098 pie=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PieSprite(2, 1, 15, 210);
099 pie.setColor(Palette.getColor("Red"));
100 pie.setSize(0.1);
101 pie.setLocation(0.3, 0.25);
102
103 pie1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PieSprite(2, 1, -30, 165);
104 pie1.setColor(Palette.getColor("Red"));
105 pie1.setSize(0.1);
106 pie1.setLocation(0.7, 0.25);
107
108 polygon=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(8);
109 polygon.setColor(Palette.getColor("Green"));
110 polygon.setSize(0.175);
111 polygon.setLocation(0.325, 0.375);
112
113 polygon1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(6);
114 polygon1.setColor(Palette.getColor("Green"));
115 polygon1.setSize(0.175);
116 polygon1.setLocation(0.675, 0.375);
117
118 arc=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ArcSprite(1, 1, 120, 230);
119 arc.setColor(Palette.getColor("Beige"));
120 arc.setSize(0.20);
121 arc.setLocation(0.125, 0.45);
122
123 arc1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ArcSprite(1, 1, -45, 65);
124 arc1.setColor(Palette.getColor("Beige"));
125 arc1.setSize(0.20);
126 arc1.setLocation(0.875, 0.45);
127
128 title=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Scream!");
129 title.setColor(Palette.getColor("White"));
130 title.setSize(0.2);
131 title.setLocation(0.15, 0.05);
132
133 name=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Steven Pingel");
134 name.setColor(Palette.getColor("White"));
135 name.setSize(0.3);
136 name.setLocation(.25, 0.9);
137
138 pupil=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(-2, 2, 2, 4, 5, 1, -1, -1, 1, 2);
139 pupil.setColor(Palette.getColor("Black"));
140 pupil.setSize(0.1);
141 pupil.setLocation(0.325, 0.375);
142
143 pupil1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(1, 1, -1, 2, -1, -1, 2, -2);
144 pupil1.setColor(Palette.getColor("Black"));
145 pupil1.setSize(0.1);
146 pupil1.setLocation(0.675, 0.375);
147
148 rectangle1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor RectangleSprite(3, 0.5);
149 rectangle1.setColor(Palette.getColor("Indigo"));
150 rectangle1.setSize(.5);
151 rectangle1.setLocation(0.5, 0.15);
152
153 line=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor LineSprite(0, 1, .5, 1);
154 line.setColor(Palette.getColor("Black"));
155 line.setSize(.25);
156 line.setLocation(.8, .8);
157
158 line1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor LineSprite(0, 0.5, .5, 1);
159 line1.setColor(Palette.getColor("Black"));
160 line1.setSize(.25);
161 line1.setLocation(.2, .8);
162 }close braces end code blocks and must match an earlier open brace
163
164 /**adds the sprites to the screen*/
165 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value addSprites()
166 {open braces start code blocks and must be matched with a close brace
167 canvas.addSprite(image);
168 canvas.addSprite(oval);
169 canvas.addSprite(oval1);
170 canvas.addSprite(rectangle);
171 canvas.addSprite(image1);
172 canvas.addSprite(pie);
173 canvas.addSprite(pie1);
174 canvas.addSprite(arc);
175 canvas.addSprite(arc1);
176 canvas.addSprite(polygon);
177 canvas.addSprite(polygon1);
178 canvas.addSprite(title);
179 canvas.addSprite(name);
180 canvas.addSprite(pupil);
181 canvas.addSprite(pupil1);
182 canvas.addSprite(rectangle1);
183 canvas.addSprite(line);
184 canvas.addSprite(line1);
185
186
187 }close braces end code blocks and must match an earlier open brace
188 }close braces end code blocks and must match an earlier open brace
|