JacobTyler/InteractiveArt

From ggc

Jump to: navigation, search

001 package JacobTyler;
002 
003 import wiki.Wiki;
004 import fang.*;
005 import java.awt.*;
006 import java.awt.geom.*;
007 //makes it so I can add movement to my game
008 import Beta.OutlineTracker;
009 
010 /**
011  * All about my game here.
012  @author Jolson
013  */
014 public class InteractiveArt extends GameLoop
015 {
016   //the sprites of my game
017   private Sprite start, box1, outline, names, title;
018   //the images
019   private ImageSprite background;
020   //adds a outline to my game
021   private OutlineTracker tracker;
022   //adds the rotation of sprite
023   private ProjectileTracker spin;
024   //sets up the stages
025   private int clickCount;
026   private Sound sound=new Sound(Wiki.getMedia("Ding1.wav"));
027 
028   //makes the sprites that I need
029   public void startGame()
030   {
031     makeSprite();
032     toggleAudible();
033     pauseToggle();
034     clickCount=0;
035     setHelpText("Press either q, w, or e to change the color."+
036                 "Click to randomly change the size of the triangle."+
037                 "Do not double click at the start or it will freeze!!");
038   }
039 
040   //starts game
041   public void makeSprite()
042   {
043     createOutline();
044     createBackground();
045     createStart();
046     createNames();
047     createTitle();
048   }
049 
050   //sets the path of the sprites I want to move
051   public void createOutline()
052   {
053     outline=new RectangleSprite(1,1);
054     outline.setScale(.25);
055     outline.setLocation(.5,.5);
056     canvas.addSprite(outline);
057   }
058 
059   //this set the background of the game
060   public void createBackground()
061   {
062     background=new ImageSprite(Wiki.getMedia("SandBackground.jpg"));
063     background.setScale(1);
064     background.setLocation(.5,.5);
065     canvas.addSprite(background);
066   }
067 
068   //this is the string sprite that tells the player how to start playing the game
069   public void createStart()
070   {
071     start=new StringSprite("Click to Start");
072     start.setScale(.7);
073     start.setLocation(.5,.6);
074     start.setColor(Color.RED);
075     canvas.addSprite(start);
076 
077     Point2D.Double rotate=new Point2D.Double(0.0,0.0);
078     spin=new ProjectileTracker(rotate);
079     spin.setAngularVelocity(1);
080     start.setTracker(spin);
081   }
082 
083   public void createNames()
084   {
085     names=new StringSprite("Authors: Tyler and Jacob");
086     names.setColor(Color.BLACK);
087     names.setScale(.35);
088     names.setLocation(.2,.05);
089     canvas.addSprite(names);
090   }
091 
092   public void createTitle()
093   {
094     title=new StringSprite("Interactive Image");
095     title.setColor(Color.RED);
096     title.setScale(.8);
097     title.setLocation(.5,.19);
098     canvas.addSprite(title);
099   }
100 
101   //makes a circle and follows a path around my outline
102   public void createBox1()
103   {
104     box1=new PolygonSprite(3);
105     box1.setScale(.1);
106     box1.setColor(Color.BLACK);
107     canvas.addSprite(box1);
108 
109     tracker=new OutlineTracker(outline,.5);
110     box1.setTracker(tracker);
111     box1.setLocation(tracker.getCurrentPoint());
112     tracker.setLooping(true);
113   }
114 
115   class Box1 implements Alarm
116   {
117     public void alarm()
118     {
119       createBox1();
120     }
121   }
122 
123   public void advanceFrame(double timePassed)
124   {
125     Point2D.Double click=getPlayer().getMouse().getClickLocation();
126     if(click!=null)
127     {
128       if(clickCount==0)
129       {
130         scheduleRelative(new Box1().5);
131       }
132     }
133     if(getPlayer().getMouse().getClickLocation()!=null)
134     {
135       if(clickCount==0)
136       {
137         canvas.removeSprite(start, names, title);
138         clickCount=1;
139       }
140       else if(clickCount==1)
141       {
142         box1.setScale(random.nextDouble());
143         sound.play();
144       }
145     }
146     if(clickCount==1)
147     {
148       if(getPlayer().getKeyboard().getLastKey()=='q')
149       {
150         box1.setColor(Color.RED);
151       }
152       if(getPlayer().getKeyboard().getLastKey()=='w')
153       {
154         box1.setColor(Color.BLUE);
155       }
156       if(getPlayer().getKeyboard().getLastKey()=='e')
157       {
158         box1.setColor(Color.GREEN);
159       }
160     }
161   }
162 }

Compiler Errors:
----------
1. ERROR in JacobTyler/InteractiveArt.java (at line 62)
	background=new ImageSprite(Wiki.getMedia("SandBackground.jpg"));
	           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The constructor ImageSprite(URL) is undefined
----------
1 problem (1 error)

Download/View JacobTyler/InteractiveArt.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