|
001 packagepackage is used to name the directory or folder a class is in Gerdes;
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 java.awt.Color;
008
009 /**
010 * Mosaic Sprites
011 * @authorthis is the Javadoc tag for documenting who created the source code Michael Gerdes
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 SpriteMosaic extendsextends means to customize or extend the functionality of a class Game
014 {open braces start code blocks and must be matched with a close brace
015 /**sets up the game*/
016 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setup()
017 {open braces start code blocks and must be matched with a close brace
018 PolygonSprite triangle=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(.5,0,1,1,0,1);
019 triangle.setSize(0.22);
020 triangle.setLocation(0.15,0.15);
021 triangle.setColor(Palette.getColor("green"));
022 addSprite(triangle);
023
024 PolygonSprite octagon=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(8);
025 octagon.setSize(0.25);
026 octagon.setLocation(0.38,0.08);
027 octagon.setColor(Palette.getColor("green"));
028 addSprite(octagon);
029
030 PolygonSprite pentagon=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(5);
031 pentagon.setSize(0.20);
032 pentagon.setLocation(0.65,0.18);
033 pentagon.setColor(Palette.getColor("Orange"));
034 addSprite(pentagon);
035
036 PolygonSprite diamond=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(4);
037 diamond.setSize(0.20);
038 diamond.setLocation(0.75,0.18);
039 diamond.setColor(Palette.getColor("brown"));
040 addSprite(diamond);
041
042 RectangleSprite carBody=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor RectangleSprite(5,2);
043 carBody.setSize(.70);
044 carBody.setLocation(.48,.6);
045 carBody.setColor(Palette.getColor("yellow"));
046 addSprite(carBody);
047
048 RectangleSprite frontdoor=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor RectangleSprite(4,4);
049 frontdoor.setSize(.2);
050 frontdoor.setLocation(.38,.6);
051 frontdoor.setColor(Palette.getColor("Magenta"));
052 addSprite(frontdoor);
053
054 RectangleSprite reardoor=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor RectangleSprite(4,4);
055 reardoor.setSize(.2);
056 reardoor.setLocation(.58,.6);
057 reardoor.setColor(Palette.getColor("green"));
058 addSprite(reardoor);
059
060 LineSprite bottomline =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,1);
061 bottomline.setSize(2);
062 bottomline.setColor(Palette.getColor("blue"));
063 addSprite(bottomline);
064
065 LineSprite topline =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,0);
066 topline.setSize(4);
067 topline.setColor(Palette.getColor("red"));
068 addSprite(topline);
069
070 LineSprite leftline =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,0,1);
071 leftline.setSize(3);
072 leftline.setColor(Palette.getColor("blue violet"));
073 addSprite(leftline);
074
075 LineSprite rightline =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,1,1);
076 rightline.setSize(3);
077 rightline.setColor(Palette.getColor("blue violet"));
078 addSprite(rightline);
079
080 ArcSprite rearHub =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor ArcSprite(0,180);
081 rearHub.setSize(.2);
082 rearHub.setLocation(.28,.7);
083 rearHub.setColor(Palette.getColor("coral"));
084 addSprite(rearHub);
085
086 ArcSprite frontHub=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ArcSprite(0,180);
087 frontHub.setSize(.2);
088 frontHub.setLocation(.68,.7);
089 frontHub.setColor(Palette.getColor("dark orange"));
090 addSprite(frontHub);
091
092 OvalSprite frontwheel =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);
093 frontwheel.setSize(.2);
094 frontwheel.setLocation(.68,.8);
095 frontwheel.setColor(Palette.getColor("medium orchid"));
096 addSprite(frontwheel);
097
098 OvalSprite rearwheel =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);
099 rearwheel.setSize(.2);
100 rearwheel.setLocation(.28,.8);
101 rearwheel.setColor(Palette.getColor("medium orchid"));
102 addSprite(rearwheel);
103
104 PieSprite rearWindshield =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor PieSprite(0,90);
105 rearWindshield.setSize(0.2);
106 rearWindshield.setLocation(0.73,0.36);
107 rearWindshield.setColor(Palette.getColor("Pink"));
108 addSprite(rearWindshield);
109
110 PieSprite frontWindshield =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor PieSprite(90,180);
111 frontWindshield.setSize(0.2);
112 frontWindshield.setLocation(0.23,0.36);
113 frontWindshield.setColor(Palette.getColor("Red"));
114 addSprite(frontWindshield);
115
116 StringSprite title =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor StringSprite("Mosaic Sprites");
117 title.setSize(0.5);
118 title.topJustify();
119 title.setLocation(.5,0);
120 title.setColor(Palette.getColor("Orange"));
121 addSprite(title);
122
123 StringSprite artist =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor StringSprite("Michael Gerdes");
124 artist.setSize(.5);
125 artist.bottomJustify();
126 artist.setLocation(.5,1);
127 artist.setColor(Palette.getColor("Orange"));
128 addSprite(artist);
129
130 ImageSprite river =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor ImageSprite("Home_011.JPG");
131 river.setSize(0.2);
132 river.setLocation(0.57,0.39);
133 addSprite(river);
134
135 ImageSprite image2 =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor ImageSprite("Home_010.JPG");
136 image2.setSize(0.2);
137 image2.setLocation(0.43,0.39);
138 addSprite(image2);
139 }close braces end code blocks and must match an earlier open brace
140 }close braces end code blocks and must match an earlier open brace
|