jam/MyMasterpiece

From ggc

Jump to: navigation, search

001 package jam;
002 
003 import wiki.Wiki;
004 import fang2.*;
005 import java.awt.*;
006 import java.awt.geom.*;
007 
008 /**
009  * All about my game here.
010  @author Jam Jenkins
011  */
012 public class MyMasterpiece extends GameLoop
013 {
014   /**an oval*/
015   private int stage=0;
016   private Sound sound=new Sound("DingLower.wav");
017   private StringSprite spin;
018   private ProjectileTracker tracker;
019 
020   /**sets up the game*/
021   public void startGame()
022   {
023     setHelpText("Information about my art\nwill go here.");
024 
025     StringSprite signature=new StringSprite("by Jam Jenkins");
026     signature.setLineHeight(0.1);
027     signature.leftJustify();
028     signature.bottomJustify();
029     signature.setLocation(0.011);
030     canvas.addSprite(signature);
031 
032     StringSprite title=new StringSprite("Masterpiece");
033     title.setFontFamilyName("Algerian");
034     title.setColor(Color.YELLOW);
035     title.topJustify();
036     title.setWidth(0.9);
037     title.setLocation(0.50.01);
038     canvas.addSprite(title);
039   }
040 
041   /**makes the sprites*/
042   private void makeSprites()
043   {
044     spin=new StringSprite("Jelly\nDonut");
045     spin.setScale(0.25);
046     spin.setLocation(0.50.5);
047 
048     tracker=new ProjectileTracker(
049                 random.nextDouble()-0.5,
050                 random.nextDouble()-0.5);
051     tracker.setAngularVelocity(1);
052     spin.setTracker(tracker);
053   }
054 
055 
056   /**adds the sprites to the screen*/
057   private void addSprites()
058   {
059     canvas.addSprite(spin);
060   }
061 
062 
063   class GoAway implements Alarm
064   {
065     int timesToExecute=70;
066 
067     public void alarm()
068     {
069       timesToExecute--;
070       fade();
071       if(timesToExecute>&& getPlayer().getKeyboard().getLastKey()!='s')
072         scheduleRelative(this0.1);
073       else
074       {
075         canvas.removeAllSprites();
076         startStage1();
077       }
078     }
079   }
080 
081   private void startStage1()
082   {
083     System.out.println("Stage 1 starting");
084     makeSprites();
085     addSprites();
086     stage=1;
087   }
088 
089   private void fade()
090   {
091     Sprite[] all=canvas.getAllSprites();
092     for(Sprite single: all)
093     {
094       Color color=single.getColor();
095       single.setColor(new Color(color.getRed(), color.getGreen(),
096                                 color.getBlue(),
097                                 Math.max(0, color.getAlpha()-4)));
098     }
099   }
100 
101   private void doStage0()
102   {
103     Point2D.Double click=getPlayer().getMouse().getClickLocation();
104     if(click!=null)
105     {
106       scheduleRelative(new GoAway()1);
107       sound.play(click.x);
108       stage=-1;
109     }
110   }
111 
112   private void doStage1()
113   {
114     if(spin.getLocation().y>|| spin.getLocation().y<0)
115     {
116       Point2D.Double direction=tracker.getVelocity();
117       direction.y*=-1;
118       tracker.setVelocity(direction);
119       tracker.setAngularVelocity(-tracker.getAngularVelocity());
120     }
121     if(spin.getLocation().x>|| spin.getLocation().x<0)
122     {
123       Point2D.Double direction=tracker.getVelocity();
124       direction.x*=-1;
125       tracker.setVelocity(direction);
126       tracker.setAngularVelocity(-tracker.getAngularVelocity());
127     }
128     Point2D.Double leftClick=getPlayer().getMouse().getLeftClickLocation();
129     Point2D.Double rightClick=getPlayer().getMouse().getRightClickLocation();
130     if(leftClick!=null)
131       spin.scale(1.05);
132     if(rightClick!=null)
133       spin.scale(0.95);
134   }
135 
136   /**handle input and game events*/
137   public void advanceFrame(double timePassed)
138   {
139     if(stage==0)
140     {
141       doStage0();
142     }
143     if(stage==1)
144     {
145       doStage1();
146     }
147   }
148 }

Compiler Errors:
----------
1. ERROR in jam/MyMasterpiece.java (at line 18)
	private ProjectileTracker tracker;
	        ^^^^^^^^^^^^^^^^^
ProjectileTracker cannot be resolved to a type
----------
2. ERROR in jam/MyMasterpiece.java (at line 48)
	tracker=new ProjectileTracker(
	^^^^^^^
tracker cannot be resolved
----------
13 problems (13 errors)

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