jam/CompositeExample

From ggc

Jump to: navigation, search

01 package jam;
02 
03 import wiki.Wiki;
04 import fang.*;
05 import java.awt.*;
06 import java.awt.geom.*;
07 
08 /**
09  * All about my game here.
10  @author Jam Jenkins
11  */
12 public class CompositeExample extends GameLoop
13 {
14   /**an oval*/
15   private CompositeSprite oval;
16 
17   /**sets up the game*/
18   public void startGame()
19   {
20     makeSprites();
21     addSprites();
22   }
23 
24   /**makes the sprites*/
25   private void makeSprites()
26   {
27     oval=new CompositeSprite();
28     PolygonSprite pentagon=new PolygonSprite(5);
29     pentagon.setScale(0.25);
30     pentagon.setLocation(0.050);
31     oval.addShape(pentagon.getShape()Color.RED);
32     OvalSprite circle=new OvalSprite(11);
33     circle.setScale(0.25);
34     circle.setLocation(0.50);
35     oval.addShape(circle.getShape()Color.YELLOW);
36     pentagon.setLocation(0.950);
37     oval.addShape(pentagon.getShape()Color.BLUE);
38     oval.setScale(0.75);
39     oval.setLocation(0.50.5);
40   }
41 
42   /**adds the sprites to the screen*/
43   private void addSprites()
44   {
45     canvas.addSprite(oval);
46   }
47 
48   /**handle input and game events*/
49   public void advanceFrame(double timePassed)
50   {
51     oval.setLocation(getPlayer().getMouse().getLocation());
52     if(getPlayer().getMouse().getClickLocation()!=null)
53     {
54       oval.setScale(random.nextDouble());
55     }
56     if(getPlayer().getKeyboard().getLastKey()=='r')
57     {
58       oval.setColor(Color.RED);
59     }
60     if(getPlayer().getKeyboard().getLastKey()=='w')
61     {
62       oval.setColor(Color.WHITE);
63     }
64   }
65 }

Compiler Errors:
----------
1. ERROR in jam/CompositeExample.java (at line 31)
	oval.addShape(pentagon.getShape(), Color.RED);
	     ^^^^^^^^
The method addShape(Shape, Color) is undefined for the type CompositeSprite
----------
2. ERROR in jam/CompositeExample.java (at line 35)
	oval.addShape(circle.getShape(), Color.YELLOW);
	     ^^^^^^^^
The method addShape(Shape, Color) is undefined for the type CompositeSprite
----------
3 problems (3 errors)

Download/View jam/CompositeExample.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