|
001 packagepackage is used to name the directory or folder a class is in Min;
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 * @authornull 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 SpriteMosaic 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 /**sets up the game*/
014 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setup()
015 {open braces start code blocks and must be matched with a close brace
016 //making circle, size about half middle of the screen color blue
017 OvalSprite circ;
018 circ =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor OvalSprite(1,1);
019 circ.setSize(0.5);
020 circ.setLocation(0.5, 0.5 );
021 circ.setColor(Palette.getColor("blue"));
022 addSprite(circ);
023
024 //making oblong, size about .3 left side of the screen color orange
025 OvalSprite oval;
026 oval =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor OvalSprite(6,3);
027 oval.setSize(0.3);
028 oval.setLocation (0.3, 0.5);
029 oval.setColor(Palette.getColor("orange"));
030 addSprite(oval);
031
032 //making oblong, size about .3 right side of the screen color orange
033 OvalSprite oval2;
034 oval2 =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor OvalSprite(6,3);
035 oval2.setSize(0.3);
036 oval2.setLocation (0.7, 0.5);
037 oval2.setColor(Palette.getColor("orange"));
038 addSprite(oval2);
039
040 //making rectangle size .3 same side about middle down color red
041 RectangleSprite rect;
042 rect =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor RectangleSprite(3,3);
043 rect.setSize(0.3);
044 rect.setLocation (0.5, 0.8);
045 rect.setColor(Palette.getColor("red"));
046 addSprite(rect);
047
048 //making rectangle size .1 one longer side about middle top color magenta
049 RectangleSprite rect2;
050 rect2 =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor RectangleSprite(1,5);
051 rect2.setSize(0.1);
052 rect2.setLocation (0.5, 0.3);
053 rect2.setColor(Palette.getColor("Magenta"));
054 addSprite(rect2);
055
056 //making polygon size .1 5 side about left side middle color green
057 PolygonSprite poly;
058 poly =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor PolygonSprite(5);
059 poly.setSize(.1);
060 poly.setLocation(0.3, 0.5);
061 poly.setColor(Palette.getColor("green"));
062 addSprite(poly);
063
064 //making polygon size .1 6 side about right side middle color green
065 PolygonSprite poly2;
066 poly2 =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor PolygonSprite(6);
067 poly2.setSize(.1);
068 poly2.setLocation(0.7, 0.5);
069 poly2.setColor(Palette.getColor("green"));
070 addSprite(poly2);
071
072 //making polygon size .2 3 side about left side upper color cyan
073 PolygonSprite poly3;
074 poly3 =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor PolygonSprite(0,0,0,1,0,1,1,1);
075 poly3.setSize(.2);
076 poly3.setLocation(0.3, 0.3);
077 poly3.setColor(Palette.getColor("Cyan"));
078 addSprite(poly3);
079
080 //making polygon size .2 3 side about right side upper color cyan
081 PolygonSprite poly4;
082 poly4 =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor PolygonSprite(1,1,1,0,0,1,0,1);
083 poly4.setSize(.2);
084 poly4.setLocation(0.7, 0.3);
085 poly4.setColor(Palette.getColor("Cyan"));
086 addSprite(poly4);
087
088 //making thin line size .2 about top middle color white
089 LineSprite thin;
090 thin =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor LineSprite(1,0,0,1);
091 thin.setSize(0.2);
092 thin.setLocation(0.5, 0.25);
093 thin.setColor(Palette.getColor("white"));
094 addSprite(thin);
095
096 //making thick line size .5 about top middle color white
097 LineSprite thick;
098 thick =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor LineSprite(1,1,0,1);
099 thick.setSize(0.5);
100 thick.setLineThickness(.1);
101 thick.setLocation(0.5, 0.25);
102 thick.setColor(Palette.getColor("white"));
103 addSprite(thick);
104
105 //making pie size about .2 left bottom middle opening on the right side yellow
106 PieSprite pie;
107 pie =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor PieSprite(3,2,90,10);
108 pie.setSize(0.2);
109 pie.setLocation(0.3, 0.7);
110 pie.setColor(Palette.getColor("yellow"));
111 addSprite(pie);
112
113 //making pie size about .2 right bottom middle opening on the left side yellow
114 PieSprite pie2;
115 pie2 =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor PieSprite(2,3,200,120);
116 pie2.setSize(0.2);
117 pie2.setLocation(0.7, 0.7);
118 pie2.setColor(Palette.getColor("yellow"));
119 addSprite(pie2);
120
121 //making wierd arc
122 ArcSprite arc;
123 arc =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor ArcSprite(1,1,120,50);
124 arc.setSize(0.1);
125 arc.setLocation (0.3, 0.9);
126 arc.setColor(Palette.getColor("Yellow Green"));
127 addSprite(arc);
128
129 //making wierd arc
130 ArcSprite arc2;
131 arc2 =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor ArcSprite(2,1,200,100);
132 arc2.setSize(0.1);
133 arc2.setLocation (0.7, 0.9);
134 arc2.setColor(Palette.getColor("Yellow Green"));
135 addSprite(arc2);
136
137 //making string sprite
138 StringSprite top;
139 top =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor StringSprite("MinKim");
140 top.setSize(.2);
141 top.topJustify();
142 top.setLocation(0.5, 0.1);
143 top.setColor(Palette.getColor("grey"));
144 addSprite(top);
145
146 //making string sprite
147 StringSprite bottom;
148 bottom =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor StringSprite("2008");
149 bottom.setSize(.2);
150 bottom.bottomJustify();
151 bottom.setLocation(0.5, 0.9);
152 bottom.setColor(Palette.getColor("grey"));
153 addSprite(bottom);
154
155 //inserting image
156 ImageSprite car;
157 car =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor ImageSprite("Car123.jpg");
158 car.setSize(.2);
159 car.setLocation(0.1, 0.7);
160 addSprite(car);
161
162 //inserting image
163 ImageSprite car2;
164 car2 =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor ImageSprite("Car144.jpg");
165 car2.setSize(.1);
166 car2.setLocation(0.9, 0.7);
167 addSprite(car2);
168 }close braces end code blocks and must match an earlier open brace
169
170 /**handle input and game events*/
171 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value advance()
172 {open braces start code blocks and must be matched with a close brace}close braces end code blocks and must match an earlier open brace
173 }close braces end code blocks and must match an earlier open brace
|