|
001 packagepackage is used to name the directory or folder a class is in Drew;
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 * A game with meny shapes in varius spots.
009 * @authornull Drew Schwarz
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 OvalSprite left;
017 left =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor OvalSprite(.5, .5);
018 left.setSize(0.2);
019 left.setLocation(.1,.2);
020 left.setColor(Palette.getColor("Dark Orchid"));
021 addSprite(left);
022
023 OvalSprite right;
024 right =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor OvalSprite(.3, .5);
025 right.setSize(0.2);
026 right.setLocation(.9,.2);
027 right.setColor(Palette.getColor("Aquamarine"));
028 addSprite(right);
029
030 RectangleSprite midleft;
031 midleft=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor RectangleSprite(.5,.5);
032 midleft.setSize(.2);
033 midleft.setLocation(.4,.5);
034 midleft.setColor(Palette.getColor("Brown"));
035 addSprite(midleft);
036
037 RectangleSprite midright;
038 midright=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor RectangleSprite(.3,.5);
039 midright.setSize(.2);
040 midright.setLocation(.6,.5);
041 midright.setColor(Palette.getColor("Dark Orchid"));
042 addSprite(midright);
043
044 PolygonSprite leftp;
045 leftp =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor PolygonSprite (5);
046 leftp.setSize(.10);
047 leftp.setLocation(.1, .45);
048 leftp.setColor(Palette.getColor("White Smoke"));
049 addSprite(leftp);
050
051 PolygonSprite rightp;
052 rightp =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor PolygonSprite (.7,.2,.6,.9,.9,.3,.8,.6,.45,.55);
053 rightp.setSize(.10);
054 rightp.setLocation(.9, .45);
055 rightp.setColor(Palette.getColor("Dark Orchid"));
056 addSprite(rightp);
057
058 PolygonSprite boo;
059 boo =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor PolygonSprite (5);
060 boo.setSize(.10);
061 boo.setLocation(.3, .25);
062 boo.setColor(Palette.getColor("Dark Orchid"));
063 addSprite(boo);
064
065 PolygonSprite boom;
066 boom =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor PolygonSprite (.7,.25,.6,.35,.9,.15);
067 boom.setSize(.10);
068 boom.setLocation(.7, .25);
069 boom.setColor(Palette.getColor("Dark Orchid"));
070 addSprite(boom);
071
072 LineSprite down;
073 down=this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor LineSprite (0,0,1,1);
074 down.setSize(.15);
075 down.setLineThickness(.1);
076 down.setLocation(.4,.2);
077 down.setColor(Palette.getColor("Dark Orchid"));
078 addSprite(down);
079
080 LineSprite up;
081 up=this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor LineSprite (0,1,1,0);
082 up.setSize(.15);
083 up.setLineThickness(.15);
084 up.setLocation(.6,.2);
085 up.setColor(Palette.getColor("Saddle Brown"));
086 addSprite(up);
087
088 PieSprite low;
089 low =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor PieSprite(1,1,20,345);
090 low.setSize(.19);
091 low.setLocation(.1,.9);
092 low.setColor(Palette.getColor("Dark Orchid"));
093 addSprite(low);
094
095 PieSprite low2;
096 low2 =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor PieSprite(1,1,30,270);
097 low2.setSize(.19);
098 low2.setLocation(.9,.9);
099 low2.setColor(Palette.getColor("Yellow"));
100 addSprite(low2);
101
102 ArcSprite dull;
103 dull=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ArcSprite(1,1,20,90);
104 dull.setSize(.2);
105 dull.setLocation(.65,.75);
106 dull.setColor(Palette.getColor("Dark Violet"));
107 addSprite(dull);
108
109 ArcSprite duller;
110 duller=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,300);
111 duller.setSize(.2);
112 duller.setLocation(.35,.75);
113 duller.setColor(Palette.getColor("Tan"));
114 addSprite(duller);
115
116 StringSprite d;
117 d =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor StringSprite("Drew Schwarz");
118 d.setHeight(.07);
119 d.bottomJustify();
120 d.setLocation(.5,1);
121 addSprite(d);
122
123 StringSprite t;
124 t =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor StringSprite("SpriteMosaic");
125 t.setHeight(.07);
126 t.topJustify();
127 t.setLocation(.5,0);
128 addSprite(t);
129
130 ImageSprite oval;
131 oval =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor ImageSprite("High_all.PNG");
132 oval.setSize(.20);
133 oval.setLocation(.1,.7);
134 addSprite(oval);
135
136 ImageSprite what;
137 what =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor ImageSprite("Whasfioaskdjfas.PNG");
138 what.setSize(.20);
139 what.setLocation(.9,.7);
140 addSprite(what);
141 }close braces end code blocks and must match an earlier open brace
142 }close braces end code blocks and must match an earlier open brace
|