|
001 packagepackage is used to name the directory or folder a class is in Charles;
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 here.
009 * @authorthis is the Javadoc tag for documenting who created the source code Charles
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 CharlesMyOval 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 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setup()
014 {open braces start code blocks and must be matched with a close brace
015
016 OvalSprite oval=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite(0.75, 0.75);
017 oval.setLocation(0.5, 0.5);
018 oval.setSize(.95);
019 addSprite(oval);
020
021 PolygonSprite mouth=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(5);
022 mouth.setLocation(0.5, 0.82);
023 mouth.setSize(0.2);
024 mouth.setColor(Color.RED);
025 addSprite(mouth);
026
027 OvalSprite mouthin=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite(0.075, 0.05);
028 mouthin.setLocation(0.5, 0.83);
029 mouthin.setSize(0.1);
030 mouthin.setColor(Color.BLACK);
031 addSprite(mouthin);
032
033 OvalSprite eye1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite(2, 1);
034 eye1.setLocation(0.3, 0.3);
035 eye1.setSize(0.25);
036 eye1.setColor(Color.GREEN);
037 addSprite(eye1);
038
039 OvalSprite pup1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite(1, 1);
040 pup1.setLocation(0.3, 0.3);
041 pup1.setSize(0.1);
042 pup1.setColor(Color.BLACK);
043 addSprite(pup1);
044
045 OvalSprite eye2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite(2, 1);
046 eye2.setLocation(0.7, 0.3);
047 eye2.setSize(.25);
048 eye2.setColor(Color.GREEN);
049 addSprite(eye2);
050
051 OvalSprite pup2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite(1, 1);
052 pup2.setLocation(0.7, 0.3);
053 pup2.setSize(.1);
054 pup2.setColor(Color.BLACK);
055 addSprite(pup2);
056
057 PolygonSprite nose=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(0.5, 0.5, 0.6, 0.5, 0.6, 0.3);
058 nose.setLocation(0.45, 0.48);
059 nose.setSize(0.28);
060 nose.setColor(Color.YELLOW);
061 addSprite(nose);
062
063 PolygonSprite brow1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(0.1, 0.5, 0.2, 0.3, 0.9, 0.6);
064 brow1.setLocation(0.3, 0.21);
065 brow1.setSize(0.15);
066 brow1.setColor(Color.YELLOW);
067 addSprite(brow1);
068
069 PolygonSprite brow2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(0.1, 0.5, 0.2, 0.3, 0.9, 0.6);
070 brow2.setLocation(0.7, 0.21);
071 brow2.setSize(0.15);
072 brow2.setColor(Color.YELLOW);
073 addSprite(brow2);
074
075 PolygonSprite stash=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(0.15, 0.2, 0.05, 0.3, 0.25, 0.2, 0.35, 0.3);
076 stash.setLocation(0.5, 0.71);
077 stash.setSize(.25);
078 stash.setColor(Color.BLACK);
079 addSprite(stash);
080
081 StringSprite name=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Charles Perez");
082 name.setLocation(0.5, 0.96);
083 name.setSize(0.25);
084 name.setColor(Color.WHITE);
085 addSprite(name);
086
087 StringSprite title=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("My Mosaic");
088 title.setLocation(0.5, 0.1);
089 title.setSize(0.3);
090 title.setColor(Color.WHITE);
091 addSprite(title);
092
093 ImageSprite peace=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("Peace-sign.jpg");
094 peace.setLocation(0.75, 0.5);
095 peace.setSize(0.25);
096 addSprite(peace);
097
098 RectangleSprite square1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor RectangleSprite(2,2);
099 square1.setLocation(0.1, 0.1);
100 square1.setSize(0.15);
101 addSprite(square1);
102
103 RectangleSprite square2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor RectangleSprite(2,2);
104 square2.setLocation(0.9, 0.1);
105 square2.setSize(0.15);
106 addSprite(square2);
107
108 RectangleSprite rec=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor RectangleSprite(10, 1);
109 rec.setLocation(0.5, 0.30);
110 rec.setSize(0.18);
111 rec.setColor(Color.BLACK);
112 addSprite(rec);
113
114 ImageSprite emc=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("Eemcs.gif");
115 emc.setLocation(.25, .5);
116 emc.setSize(.20);
117 addSprite(emc);
118
119 ArcSprite arcl=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ArcSprite(1, 1, 0, 125);
120 arcl.setLocation(.25, .7);
121 arcl.setSize(0.15);
122 arcl.setColor(Color.RED);
123 addSprite(arcl);
124
125 ArcSprite arcr=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ArcSprite(1, 1, 180, 315);
126 arcr.setLocation(.75, .7);
127 arcr.setSize(0.15);
128 arcr.setColor(Color.RED);
129 addSprite(arcr);
130
131 LineSprite l1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor LineSprite(.1, .98, .3, .8);
132 l1.setLineThickness(.01);
133 l1.setColor(Color.WHITE);
134 l1.setSize(.2);
135 addSprite(l1);
136
137 LineSprite l2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor LineSprite(.9, .98, .7, .8);
138 l2.setLineThickness(.25);
139 l2.setColor(Color.WHITE);
140 l2.setSize(.2);
141 addSprite(l2);
142
143 PieSprite p1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PieSprite(1, 1, 0, 25);
144 p1.setLocation(.1, .1);
145 p1.setSize(.15);
146 p1.setColor(Palette.getColor("Wheat"));
147 addSprite(p1);
148
149 PieSprite p2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PieSprite(1, 1, 220, 25);
150 p2.setLocation(.9, .1);
151 p2.setSize(.1);
152 p2.setColor(Palette.getColor("Midnight Blue"));
153 addSprite(p2);
154 }close braces end code blocks and must match an earlier open brace
155
156 }close braces end code blocks and must match an earlier open brace
|