|
001 packagepackage is used to name the directory or folder a class is in Danielle;
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 importimport means to make the classes and/or packages available in this program java.awt.Color;
007
008 /**
009 * All about my game.
010 * @authorthis is the Javadoc tag for documenting who created the source code Danielle Kyser
011 */
012 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
013 {open braces start code blocks and must be matched with a close brace
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 //Fish
018 ImageSprite Fish;
019 Fish=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("Parrot-fish.jpg");
020 Fish.setSize(0.38);
021 Fish.setLocation(0.15,0.88);
022 addSprite(Fish);
023
024 //green oval
025 OvalSprite goval;
026 goval=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite (2,2);
027 goval.setSize(0.15);
028 goval.setLocation(0.4,0.1);
029 goval.setColor(Palette.getColor("Green"));
030 addSprite(goval);
031
032 //blue oval
033 OvalSprite boval;
034 boval=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite (3,2);
035 boval.setSize(0.15);
036 boval.setLocation(0.9,0.5);
037 boval.setColor(Palette.getColor("Blue"));
038 addSprite(boval);
039
040 //title
041 StringSprite thread;
042 thread=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite ("Aquarium");
043 thread.setSize(0.8);
044 thread.topJustify();
045 thread.setLocation(0.5,0.1);
046 thread.setColor(Palette.getColor("Pink"));
047 addSprite(thread);
048
049 //title2
050 StringSprite thread2;
051 thread2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite ("Danielle");
052 thread2.setSize(0.25);
053 thread2.bottomJustify();
054 thread2.setLocation(0.5,1);
055 thread2.setColor(Palette.getColor("Silver"));
056 addSprite(thread2);
057
058 //shark
059 ImageSprite shark;
060 shark=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("Shark.jpg");
061 shark.setSize(0.30);
062 shark.setLocation(0.10,0.60);
063 addSprite(shark);
064
065 //thick line
066 LineSprite line1;
067 line1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor LineSprite (3,3,7,7);
068 line1.setSize(40);
069 line1.setLocation(.41,.57);
070 line1.setColor(Palette.getColor("Orange"));
071 addSprite(line1);
072
073 //thin line
074 LineSprite line2;
075 line2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor LineSprite (1,3,5,7);
076 line2.setSize(.35);
077 line2.setLineThickness (0.25);
078 line2.setLocation(.60,.70);
079 line2.setColor(Palette.getColor("Purple"));
080 addSprite(line2);
081
082 //square
083 RectangleSprite square1;
084 square1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor RectangleSprite(3,2);
085 square1.setSize(0.15);
086 square1.setLocation(0.7,0.3);
087 square1.setColor(Palette.getColor("Magenta"));
088 addSprite(square1);
089
090 //rectangle
091 RectangleSprite square2;
092 square2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor RectangleSprite(5,1);
093 square2.setSize(0.15);
094 square2.setLocation(0.8,0.4);
095 square2.setColor(Palette.getColor("Aqua"));
096 addSprite(square2);
097
098 //pie
099 PieSprite pie1;
100 pie1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PieSprite(1,1,210,120);
101 pie1.setSize(0.35);
102 pie1.setLocation(0.3,0.4);
103 pie1.setColor(Palette.getColor("Red"));
104 addSprite(pie1);
105
106 //little pie
107 PieSprite pie2;
108 pie2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PieSprite(1,1,45,350);
109 pie2.setSize(0.15);
110 pie2.setLocation(0.4,0.8);
111 pie2.setColor(Palette.getColor("Lime"));
112 addSprite(pie2);
113
114 //arc
115 ArcSprite arc1;
116 arc1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ArcSprite(1,1,120,230);
117 arc1.setSize(0.15);
118 arc1.setLocation(0.8,0.8);
119 arc1.setColor(Palette.getColor("Hot Pink"));
120 addSprite(arc1);
121
122
123 //arc mini
124 ArcSprite arc2;
125 arc2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ArcSprite(1,1,-50,65);
126 arc2.setSize(0.10);
127 arc2.setLocation(0.9,0.9);
128 arc2.setColor(Palette.getColor("Yellow"));
129 addSprite(arc2);
130
131 //polygon
132 PolygonSprite poly1;
133 poly1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(8);
134 poly1.setSize(0.05);
135 poly1.setLocation(0.5,0.8);
136 poly1.setColor(Palette.getColor("Beige"));
137 addSprite(poly1);
138
139 //triangle
140 PolygonSprite poly2;
141 poly2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(3);
142 poly2.setSize(0.10);
143 poly2.setLocation(0.8,0.6);
144 poly2.setColor(Palette.getColor("Spring Green"));
145 addSprite(poly2);
146
147 //big polygon
148 PolygonSprite poly3;
149 poly3=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(3,5,4,6,7,8,4,2);
150 poly3.setSize(0.40);
151 poly3.setLocation(0.6,0.5);
152 poly3.setColor(Palette.getColor("Teal"));
153 addSprite(poly3);
154
155 //new polygon
156 PolygonSprite poly4;
157 poly4=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(2,4,8,7,6,4,5,3);
158 poly4.setSize(0.10);
159 poly4.setLocation(0.5,0.5);
160 poly4.setColor(Palette.getColor("Gold"));
161 addSprite(poly4);
162
163 }close braces end code blocks and must match an earlier open brace
164
165 /**handle input and game events*/
166 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value advance()
167 {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
168 }close braces end code blocks and must match an earlier open brace
|