MerimaKim/InteractiveArt

From ggc

Jump to: navigation, search

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

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

Download/View MerimaKim/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