|
001 packagepackage is used to name the directory or folder a class is in Moriah;
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
010 /**
011 * All about my game here.
012 * @authorthis is the Javadoc tag for documenting who created the source code Moriah Newman
013 */
014 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
015 {open braces start code blocks and must be matched with a close brace
016
017 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setup()
018 {open braces start code blocks and must be matched with a close brace
019 RectangleSprite house=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor RectangleSprite(5,5);
020 house.setColor(newnew is used to create objects by calling the constructor Color(60,100,160));
021 house.setSize(.45);
022 house.setLocation(.5,.7);
023 addSprite(house);
024
025 PolygonSprite roof=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(3);
026 roof.setColor(newnew is used to create objects by calling the constructor Color(240,60,70));
027 roof.setSize(.45);
028 roof.setLocation(.5,.3);
029 addSprite(roof);
030
031 RectangleSprite lwindow=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor RectangleSprite(5,5);
032 lwindow.setColor (newnew is used to create objects by calling the constructor Color(0,0,0));
033 lwindow.setSize(.125);
034 lwindow.setLocation(.4,.6);
035 addSprite(lwindow);
036
037 RectangleSprite door=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor RectangleSprite(2,4);
038 door.setColor(newnew is used to create objects by calling the constructor Color(23,77,16));
039 door.setSize(.25);
040 door.setLocation(.5,.8);
041 addSprite(door);
042
043 RectangleSprite rwindow=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor RectangleSprite(5,5);
044 rwindow.setColor(newnew is used to create objects by calling the constructor Color(0,0,0));
045 rwindow.setSize(.125);
046 rwindow.setLocation(.6,.6);
047 addSprite(rwindow);
048
049 OvalSprite knob=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite(1,1);
050 knob.setColor(newnew is used to create objects by calling the constructor Color(255,255,255));
051 knob.setSize(.05);
052 knob.setLocation(.475,.8);
053 addSprite(knob);
054
055 ArcSprite sun=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,360);
056 sun.setColor(Palette.getColor("Yellow"));
057 sun.setSize(.5);
058 sun.setLocation(.9,.1);
059 addSprite(sun);
060
061 ArcSprite arc=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ArcSprite(360,180,1,1);
062 arc.setColor(Palette.getColor("Yellow"));
063 arc.setSize(.2);
064 arc.setLocation(.9,.8);
065 addSprite(arc);
066
067
068 LineSprite ray=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor LineSprite(3,3,4,4);
069 ray.setColor(Palette.getColor("Orange"));
070 ray.setSize(.125);
071 ray.setLocation(.7,.1);
072 addSprite(ray);
073
074 LineSprite string=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor LineSprite(5,5,6,6);
075 string.setColor(Palette.getColor("Blue"));
076 string.setSize(.3);
077 string.setLocation(.82,.5);
078 addSprite(string);
079
080
081 ImageSprite monkey=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("monkey.GIF");
082 monkey.setSize(.3);
083 monkey.setLocation(.1,.8);
084 addSprite(monkey);
085 ImageSprite plane=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("Plane.gif");
086 plane.setSize(.2);
087 plane.setLocation(.1,.2);
088 addSprite(plane);
089
090
091
092 StringSprite text=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite(" The house of Mosanew");
093 text.setHeight(.08);
094 text.topJustify();
095 text.setLocation(.5,.1);
096 text.setColor(Palette.getColor("Green"));
097 addSprite(text);
098
099 OvalSprite topwindow=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite(1,2);
100 topwindow.setColor(Palette.getColor("White"));
101 topwindow.setSize(.175);
102 topwindow.setLocation(.5,.3);
103 addSprite(topwindow);
104
105 PolygonSprite kite=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(0,0 , .5,.25 , .5,1 ,0,.75);
106 kite.setSize(.35);
107 kite.setColor(Palette.getColor("Lime"));
108 kite.setLocation(.7,.3);
109 addSprite(kite);
110
111 StringSprite name=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite(" Moriah S. Newman");
112 name.setHeight(.05);
113 name.bottomJustify();
114 name.setLocation(.5,1);
115 name.setColor(Palette.getColor("Pink"));
116 addSprite(name);
117
118 PolygonSprite car=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(4);
119 car.setColor(Palette.getColor("Teal"));
120 car.setSize(.15);
121 car.setLocation(.7,.8);
122 addSprite(car);
123
124 PieSprite pie=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PieSprite(3, 3, 0, 25);
125 pie.setColor(Palette.getColor("Blue"));
126 pie.setSize(0.1);
127 pie.setLocation(0.5, 0.1);
128 addSprite(pie);
129
130 PieSprite pie2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PieSprite(0, 25, 3, 3);
131 pie2.setColor(Palette.getColor("Purple"));
132 pie2.setSize(0.2);
133 pie2.setLocation(0.1, 0.5);
134 addSprite(pie2);
135
136
137
138
139 }close braces end code blocks and must match an earlier open brace
140
141 }close braces end code blocks and must match an earlier open brace
|