|
001 packagepackage is used to name the directory or folder a class is in Rohrer;
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 * Assignment 3
009 * @authorthis is the Javadoc tag for documenting who created the source code Kevin Rohrer
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 Sprite_Mosaic 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
014 /**sets up the game*/
015 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setup()
016 {open braces start code blocks and must be matched with a close brace
017
018 OvalSprite oval1=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 oval1.setSize(.7);
020 oval1.setLocation(.5, .55);
021 oval1.setColor(Palette.getColor("Orange Red"));
022
023 OvalSprite oval2=this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor OvalSprite(3, 1);
024 oval2.setSize(.35);
025 oval2.setLocation(.5,.1);
026 oval2.setColor(Palette.getColor("Lawn Green"));
027
028 StringSprite text1=this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor StringSprite("My Sprite Mosaic");
029 text1.setSize(.3);
030 text1.setLocation(.5,.08);
031 text1.topJustify();
032 text1.setColor(Palette.getColor("Black"));
033
034 StringSprite text2=this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor StringSprite("BY: Kevin Rohrer");
035 text2.setSize(.5);
036 text2.leftJustify();
037 text2.bottomJustify();
038 text2.setLocation(0,1);
039 text2.setColor(Palette.getColor("White"));
040
041 ImageSprite image1=this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor ImageSprite("Java.jpg");
042 image1.setLocation(.92,.93);
043 image1.setSize(.12);
044
045 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("Fangengine2.png");
046 image2.setLocation(.75,.93);
047 image2.setSize(.12);
048
049 ArcSprite arc1=this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor ArcSprite(.3,.3,200,340);
050 arc1.setLocation(.5,.8);
051 arc1.setColor(Palette.getColor("Dark Blue"));
052
053 ArcSprite arc2=this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor ArcSprite(.15,.15,220,340);
054 arc2.setLocation(.5,.8);
055 arc2.setColor(Palette.getColor("White"));
056
057 PolygonSprite poly1=this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor PolygonSprite(6);
058 poly1.setLocation(.35,.4);
059 poly1.setSize(.2);
060 poly1.setColor(Palette.getColor("Dark Magenta"));
061
062 PolygonSprite poly2=this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor PolygonSprite(8);
063 poly2.setLocation(.35,.4);
064 poly2.setSize(.07);
065 poly2.setColor(Palette.getColor("Yellow Green"));
066
067 PolygonSprite 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,1,0,.7,.7,.3,.7);
068 poly3.setLocation(.65,.4);
069 poly3.setSize(.2);
070 poly3.setColor(Palette.getColor("Maroon"));
071
072 PolygonSprite poly4=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,1,0,.7,.7,.25,.8);
073 poly4.setLocation(.65,.4);
074 poly4.setSize(.07);
075 poly4.setColor(Palette.getColor("Lawn Green"));
076
077 RectangleSprite box1=this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor RectangleSprite(1,1);
078 box1.setLocation(.12,.85);
079 box1.setSize(.15);
080 box1.setColor(Palette.getColor("Dark Green"));
081
082 RectangleSprite box2=this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor RectangleSprite(1,2);
083 box2.setLocation(.5,.6);
084 box2.setSize(.1);
085 box2.setColor(Palette.getColor("Black"));
086
087 LineSprite line1=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);
088 line1.setLocation(.5,.1);
089 line1.setLineThickness(.02);
090 line1.setSize(1);
091 line1.setColor(Palette.getColor("Olive Drab"));
092
093 LineSprite line2=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);
094 line2.setLocation(.5,.3);
095 line2.setLineThickness(.03);
096 line2.setSize(.25);
097 line2.setColor(Palette.getColor("White"));
098
099
100 PieSprite pie1=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,120,270);
101 pie1.setLocation(.09,.85);
102 pie1.setSize(.1);
103 pie1.setColor(Palette.getColor("Dark Goldenrod"));
104
105 PieSprite pie2=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,270,60);
106 pie2.setLocation(.15,.85);
107 pie2.setSize(.1);
108 pie2.setColor(Palette.getColor("Goldenrod"));
109
110
111
112 addSprite(line1);
113 addSprite(oval1);
114 addSprite(oval2);
115 addSprite(text1);
116 addSprite(text2);
117 addSprite(image1);
118 addSprite(image2);
119 addSprite(arc1);
120 addSprite(arc2);
121 addSprite(poly1);
122 addSprite(poly2);
123 addSprite(poly3);
124 addSprite(poly4);
125 addSprite(box1);
126 addSprite(box2);
127 addSprite(pie1);
128 addSprite(pie2);
129 addSprite(line2);
130
131
132 }close braces end code blocks and must match an earlier open brace
133
134 }close braces end code blocks and must match an earlier open brace
|