|
001 packagepackage is used to name the directory or folder a class is in joseph;
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 * @authornull My Name Here
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 //Image of Atlanta
018 ImageSprite Atlanta;
019 Atlanta=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("Atlanta.jpg");
020 Atlanta.setSize(0.38);
021 Atlanta.setLocation(0.15,0.88);
022 addSprite(Atlanta);
023
024 //PieSprite - pacman
025 PieSprite pacman;
026 pacman=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,360);
027 pacman.setSize (0.75);
028 pacman.setLocation(0.5,0.5);
029 pacman.setColor(Palette.getColor("Yellow"));
030 addSprite(pacman);
031
032 //rectangle
033 RectangleSprite specialsquare;
034 specialsquare=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor RectangleSprite(1,1);
035 specialsquare.setSize(.25);
036 specialsquare.setLocation(0.9,0.7);
037 specialsquare.setColor(Palette.getColor("Lime"));
038 addSprite(specialsquare);
039
040 //square
041 RectangleSprite square;
042 square=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor RectangleSprite(5,1);
043 square.setSize(.25);
044 square.setLocation(0.82,0.7);
045 square.setColor(Palette.getColor("Dark Slate Blue"));
046 addSprite(square);
047
048 //Thick Line Sprite
049 LineSprite biggy;
050 biggy=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);
051 biggy.setSize(40);
052 biggy.setLocation(.41,.57);
053 biggy.setColor(Palette.getColor("Red"));
054 addSprite(biggy);
055
056 //Thin Line Sprite
057 LineSprite tiny;
058 tiny=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor LineSprite(1,3,4,5);
059 tiny.setSize(.35);
060 tiny.setLineThickness (0.74);
061 tiny.setLocation(.50,.70);
062 tiny.setColor(Palette.getColor("Black"));
063 addSprite(tiny);
064
065 //PieSprite - mini pacman
066 PieSprite mini;
067 mini=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);
068 mini.setSize (0.35);
069 mini.setLocation(0.4,0.5);
070 mini.setColor(Palette.getColor("Black"));
071 addSprite(mini);
072
073 //Image of the Atlanta Falcons logo
074 ImageSprite AtlantaFalcons;
075 AtlantaFalcons=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("AtlantaFalcons.png");
076 AtlantaFalcons.setSize(0.19);
077 AtlantaFalcons.setLocation(0.12,0.5);
078 addSprite(AtlantaFalcons);
079
080 //Eyes of Pacman
081 OvalSprite eyes;
082 eyes=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite(1,1);
083 eyes.setSize(0.15);
084 eyes.setLocation(0.5,0.3);
085 eyes.setColor(Palette.getColor("Silver"));
086 addSprite(eyes);
087
088 //Polygon1
089 PolygonSprite brown;
090 brown=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(6);
091 brown.setSize(0.09);
092 brown.setLocation(0.9,0.3);
093 brown.setColor(Palette.getColor("Brown"));
094 addSprite(brown);
095
096 //Polygon2
097 PolygonSprite DarkCyan;
098 DarkCyan=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(6);
099 DarkCyan.setSize(0.16);
100 DarkCyan.setLocation(0.15,0.17);
101 DarkCyan.setColor(Palette.getColor("Dark Cyan"));
102 addSprite(DarkCyan);
103
104 //Custom Polygon1 (Triangle)
105 PolygonSprite Triangle;
106 Triangle=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(3);
107 Triangle.setSize(0.16);
108 Triangle.setLocation(0.5,0.1);
109 Triangle.setColor(Palette.getColor("Fire Brick"));
110 addSprite(Triangle);
111
112 //Custom Polygon2 (Octagon)
113 PolygonSprite Octagon;
114 Octagon=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(8);
115 Octagon.setSize(0.11);
116 Octagon.setLocation(0.8,0.37);
117 Octagon.setColor(Palette.getColor("Dark Orange"));
118 addSprite(Octagon);
119
120 //Text above stating Pac-Man's Birthday'
121 StringSprite Birthday;
122 Birthday=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Pac-Man's Birthday");
123 Birthday.setSize(0.9);
124 Birthday.setLocation(0.5,0.02);
125 Birthday.topJustify();
126 Birthday.setColor(Palette.getColor("White"));
127 addSprite(Birthday);
128
129 //Text below stating the Author's name
130 StringSprite JPAI;
131 JPAI=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Joseph Argumedo");
132 JPAI.setSize(0.3);
133 JPAI.setLocation(0.5,1);
134 JPAI.bottomJustify();
135 JPAI.setColor(Palette.getColor("White"));
136 addSprite(JPAI);
137
138 //Oblong
139 OvalSprite QUESTION;
140 QUESTION=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite(5,1);
141 QUESTION.setSize(0.22);
142 QUESTION.setLocation(0.5,0.9);
143 QUESTION.setColor(Palette.getColor("Dark Green"));
144 addSprite(QUESTION);
145
146
147 }close braces end code blocks and must match an earlier open brace
148
149 /**handle input and game events*/
150 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value advance()
151 {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
152 }close braces end code blocks and must match an earlier open brace
|