MerimaKimInteractiveArt

From ggc

Jump to: navigation, search

001 import fang.*;
002 import java.awt.*;
003 import java.awt.geom.*;
004 import Beta.OutlineTracker;
005 
006 /**
007  * All about my game here.
008  @author Merima Omanovic and Kim Mooney
009  */
010 public class MerimaKimInteractiveArt extends GameLoop
011 {
012   private Sprite background;
013   /**text*/
014   private Sprite title;
015   private Sprite names;
016   /**shapes*/
017   private Sprite triangle;
018   private Sprite square;
019   /**sprite to move*/
020   private Sprite sprite;
021   /**tracker to move the sprite*/
022   private OutlineTracker tracker;
023   private Sprite outline;
024   private ProjectileTracker track;
025   /**alarm*/
026   private int timeLeft;
027   private Sound sound;
028 
029   public void startGame()
030   {
031     makeSprites();
032     addSprites();
033     setupAlarm;
034     toggleAudible();
035 
036   }
037 
038   private void makeSprites()
039   {
040     /**background picture**/
041     background=new ImageSprite(Wiki.getMedia("BG2.jpg"));
042     background.setScale(1.75);
043     background.setLocation(0.50.5);
044 
045     /**text: title and the names*/
046     title=new StringSprite("Interactive Art");
047     title.setScale(.30);
048     title.setLocation(0.50.05);
049     title.setColor(Color.BLACK);
050     names=new StringSprite("By: Merima and Kim");
051     names.setScale(.25);
052     names.setLocation(0.50.1);
053     names.setColor(Color.BLACK);
054 
055     /**shapes:big triangle, square, small triangle*/
056     triangle=new PolygonSprite(3);
057     triangle.setScale(.8);
058     triangle.setLocation(0.50.5);
059     triangle.setColor(Color.BLACK);
060 
061     square=new PolygonSprite(4);
062     square.setScale(0.2);
063     square.setColor(Color.WHITE);
064     square.setLocation(0.50.5);
065 
066     sprite=new PolygonSprite(3);
067     sprite.setScale(0.1);
068     sprite.setLocation(0.50.5);
069     sprite.setColor(Color.WHITE);
070     sprite.setBlurLength(25);
071 
072     /**outline*/
073     Sprite outline=new PolygonSprite(3);
074     outline.setScale(0.5);
075     outline.setLocation(0.50.5);
076     outline.setColor(Color.BLACK);
077     canvas.addSprite(outline);
078 
079     /**outline tracker*/
080     tracker=new OutlineTracker(outline, 0.5);
081     sprite.setTracker(tracker);
082     sprite.setLocation(tracker.getCurrentPoint());
083 
084     /**the triangle continues to move around the big triangle*/
085     tracker.setLooping(true);
086     /**rotate*/
087     Point2D.Double direction=new Point2D.Double(0.00.0);
088     track=new ProjectileTracker(direction);
089     /**rotate 1/2 a revolution per second*/
090     track.setAngularVelocity(10);
091     square.setTracker(track);
092 
093     setHelpText("Click the start button to start the game. Click the square to make it disappear. On the keyboard use the r and the e to change the colors.");
094   }
095 
096   private void makeSounds()
097   {
098     sound=new Sound(Wiki.getMedia("Ding.wav"));
099     sound.play(0.25);
100   }
101 
102   private void addSprites()
103   {
104 
105     canvas.addSprite(background);
106     canvas.addSprite(triangle);
107     canvas.addSprite(sprite);
108     canvas.addSprite(title);
109     canvas.addSprite(names);
110     canvas.addSprite(square);
111   }
112   public void advanceFrame(double timePassed)
113   {
114     Point2D.Double click=getPlayer().getMouse().getClickLocation();
115     //did they click at all
116     if(click!=null)
117     {
118       if(square.intersects(click))
119       {
120         canvas.removeSprite(square);
121       }
122     }
123     if(getPlayer().getKeyboard().getLastKey()=='e')
124     {
125       sprite.setColor(Color.BLUE);
126     }
127     if(getPlayer().getKeyboard().getLastKey()=='r')
128     {
129       sprite.setColor(Color.RED);
130     }
131   }
132   private void setupAlarmdouble time )
133   {
134     scheduleRelative(new MyAlarm( ), time ;
135   }
136 
137   private class MyAlarm implements Alarm
138   {
139     public void alarm( )
140     {
141       triangle.setVisible!triangle.isVisible( ) ) ;
142       scheduleRelativethis;
143     }
144   }
145 }
146 

Compiler Errors:
----------
1. ERROR in MerimaKimInteractiveArt.java (at line 41)
	background=new ImageSprite(Wiki.getMedia("BG2.jpg"));
	           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The constructor ImageSprite(URL) is undefined
----------
1 problem (1 error)

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