Assignment 3

From ggc

Jump to: navigation, search

001 import fang.*;
002 import java.awt.*;
003 import java.awt.geom.*;
004 import java.awt.Color;
005 
006 /**
007  * I did my best to make a face.
008  @author Steven Pingel
009  */
010 public class Assignment_3 extends GameLoop
011 {
012   /**an Image of Fire**/
013   private Sprite image;
014 
015   /**an circle*/
016   private Sprite oval;
017 
018   /**an oval*/
019   private Sprite oval1;
020 
021   /**a rectangle*/
022   private Sprite rectangle;
023 
024   /**the Image on the Nose*/
025   private Sprite image1;
026 
027   /**the left eyebrow/pie*/
028   private Sprite pie;
029 
030   /**the right eyebrow/pie*/
031   private Sprite pie1;
032 
033   /**the left eye/polygon*/
034   private Sprite polygon;
035 
036   /**the right eye/polygon*/
037   private Sprite polygon1;
038 
039   /**the left ear/arc*/
040   private Sprite arc;
041 
042   /**the right ear/arc*/
043   private Sprite arc1;
044 
045   /**the title*/
046   private Sprite title;
047 
048   /**my name*/
049   private Sprite name;
050 
051   /**the left pupil*/
052   private Sprite pupil;
053 
054   /**the right pupil*/
055   private Sprite pupil1;
056 
057   /**the hat*/
058   private Sprite rectangle1;
059 
060   /**the right line*/
061   private Sprite line;
062 
063   /**the left line*/
064   private Sprite line1;
065 
066   /**sets up the game*/
067   public void startGame()
068   {
069     makeSprites();
070     addSprites();
071   }
072 
073   /**makes the sprites*/
074   private void makeSprites()
075   {
076     image=new ImageSprite("Fire.jpg");
077     image.setSize(1.25);
078     image.setLocation(0.50.5);
079 
080     oval=new OvalSprite(33);
081     oval.setScale(0.75);
082     oval.setLocation(0.50.5);
083 
084     oval1=new OvalSprite(31);
085     oval1.setColor(Palette.getColor("Midnight Blue"));
086     oval1.setScale(0.50);
087     oval1.setLocation(0.50.75);
088 
089     rectangle=new RectangleSprite(11);
090     rectangle.setColor(Palette.getColor("Maroon"));
091     rectangle.setSize(.15);
092     rectangle.setLocation(0.50.5);
093 
094     image1=new ImageSprite("Busa.jpg");
095     image1.setSize(.1);
096     image1.setLocation(0.50.5);
097 
098     pie=new PieSprite(2115210);
099     pie.setColor(Palette.getColor("Red"));
100     pie.setSize(0.1);
101     pie.setLocation(0.30.25);
102 
103     pie1=new PieSprite(21, -30165);
104     pie1.setColor(Palette.getColor("Red"));
105     pie1.setSize(0.1);
106     pie1.setLocation(0.70.25);
107 
108     polygon=new PolygonSprite(8);
109     polygon.setColor(Palette.getColor("Green"));
110     polygon.setSize(0.175);
111     polygon.setLocation(0.3250.375);
112 
113     polygon1=new PolygonSprite(6);
114     polygon1.setColor(Palette.getColor("Green"));
115     polygon1.setSize(0.175);
116     polygon1.setLocation(0.6750.375);
117 
118     arc=new ArcSprite(11120230);
119     arc.setColor(Palette.getColor("Beige"));
120     arc.setSize(0.20);
121     arc.setLocation(0.1250.45);
122 
123     arc1=new ArcSprite(11, -4565);
124     arc1.setColor(Palette.getColor("Beige"));
125     arc1.setSize(0.20);
126     arc1.setLocation(0.8750.45);
127 
128     title=new StringSprite("Scream!");
129     title.setColor(Palette.getColor("White"));
130     title.setSize(0.2);
131     title.setLocation(0.150.05);
132 
133     name=new StringSprite("Steven Pingel");
134     name.setColor(Palette.getColor("White"));
135     name.setSize(0.3);
136     name.setLocation(.250.9);
137 
138     pupil=new PolygonSprite(-222451, -1, -112);
139     pupil.setColor(Palette.getColor("Black"));
140     pupil.setSize(0.1);
141     pupil.setLocation(0.3250.375);
142 
143     pupil1=new PolygonSprite(11, -12, -1, -12, -2);
144     pupil1.setColor(Palette.getColor("Black"));
145     pupil1.setSize(0.1);
146     pupil1.setLocation(0.6750.375);
147 
148     rectangle1=new RectangleSprite(30.5);
149     rectangle1.setColor(Palette.getColor("Indigo"));
150     rectangle1.setSize(.5);
151     rectangle1.setLocation(0.50.15);
152 
153     line=new LineSprite(01.51);
154     line.setColor(Palette.getColor("Black"));
155     line.setSize(.25);
156     line.setLocation(.8.8);
157 
158     line1=new LineSprite(00.5.51);
159     line1.setColor(Palette.getColor("Black"));
160     line1.setSize(.25);
161     line1.setLocation(.2.8);
162   }
163 
164   /**adds the sprites to the screen*/
165   private void addSprites()
166   {
167     canvas.addSprite(image);
168     canvas.addSprite(oval);
169     canvas.addSprite(oval1);
170     canvas.addSprite(rectangle);
171     canvas.addSprite(image1);
172     canvas.addSprite(pie);
173     canvas.addSprite(pie1);
174     canvas.addSprite(arc);
175     canvas.addSprite(arc1);
176     canvas.addSprite(polygon);
177     canvas.addSprite(polygon1);
178     canvas.addSprite(title);
179     canvas.addSprite(name);
180     canvas.addSprite(pupil);
181     canvas.addSprite(pupil1);
182     canvas.addSprite(rectangle1);
183     canvas.addSprite(line);
184     canvas.addSprite(line1);
185 
186 
187   }
188 }

Compiler Errors:
----------
1. ERROR in Assignment_3.java (at line 89)
	rectangle=new RectangleSprite(1, 1);
	          ^^^^^^^^^^^^^^^^^^^^^^^^^
The constructor RectangleSprite(int, int) is undefined
----------
2. ERROR in Assignment_3.java (at line 89)
	rectangle=new RectangleSprite(1, 1);
	          ^^^^^^^^^^^^^^^^^^^^^^^^^
Type mismatch: cannot convert from RectangleSprite to Sprite
----------
4 problems (4 errors)

Download/View Assignment_3.java




Views
Personal tools
Add to 
del.icio.usAdd to 
diggAdd to 
FacebookAdd to 
favoritesAdd to 
GoogleAdd to 
MySpaceAdd to 
PrintAdd to 
SlashdotAdd to 
StumbleUponAdd to 
Twitter