NickandChris/InteractiveArt

From ggc

Jump to: navigation, search

001 package NickandChris;
002 
003 import wiki.Wiki;
004 import fang.*;
005 import java.awt.*;
006 import java.awt.geom.*;
007 import Beta.*;
008 
009 /**
010  * Interactive Art.
011  @author Nmckee and Cgarrett
012  */
013 public class InteractiveArt extends GameLoop
014 {
015   /** Declares variables */
016   private OutlineTracker track;
017   private Sprite heart;
018   private StringSprite title;
019   private StringSprite author;
020   private Sprite background;
021   private Sprite loli;
022   private Sprite pedo;
023   private Point2D.Double whereClick;
024   private Sound sound1;
025   private Sound sound2;
026   private Sound sound3;
027   private boolean sticker = false;
028 
029   /** Starts game */
030   public void startGame()
031   {
032     /** Gives the background the pink color */
033     background= new PolygonSprite(4);
034     background.setScale(3);
035     background.setColor(Color.PINK);
036     background.setLocation(0.5,0.5);
037     canvas.addSprite(background);
038 
039     /** Initial picture of the girl */
040     loli=new ImageSprite(Wiki.getMedia("Lolinew2.gif"));
041     loli.setScale(0.30);
042     loli.setLocation(0.50.5);
043     canvas.addSprite(loli);
044 
045     /** Calls methods */
046     makeStrings();
047     makeSounds();
048     makePath();
049 
050     /** Toggles the sound always on */
051     toggleAudible();
052 
053     setHelpText(
054         "Click anywhere in the background to place the girl.<br><br>"+
055         "Allow the sound clips to completely play.<br><br>"+
056         "Click her again to unstick her from the background.<br><br>"+
057         "Enjoy your lolicious art.");
058   }
059 
060   /** Creates the title and author text */
061   private void makeStrings()
062   {
063     title= new StringSprite(" Title: Interactive Art");
064     title.setHeight(0.04);
065     title.setColor(Color.BLACK);
066     title.leftJustify();
067     title.topJustify();
068     title.setLocation(0,0);
069     canvas.addSprite(title);
070 
071     author= new StringSprite(" Authors: Nick M. & Chris G.");
072     author.setHeight(0.04);
073     author.setColor(Color.BLACK);
074     author.rightJustify();
075     author.topJustify();
076     author.setLocation(1,0);
077     canvas.addSprite(author);
078   }
079 
080   /** Creates the sound */
081   private void makeSounds()
082   {
083     sound1 =new Sound(Wiki.getMedia("Lolisound1.wav"));
084     sound3 =new Sound(Wiki.getMedia("Grunt.wav"));
085   }
086 
087   /** Creates the path for the heart picture to follow */
088   private void makePath()
089   {
090     heart=new ImageSprite(Wiki.getMedia("Heart1.gif"));
091     heart.setLocation(0.50.5);
092     heart.setScale(0.1);
093     track= new OutlineTracker(0.2001100);
094     track.setLooping(true);
095     heart.setTracker(track);
096     heart.setLocation(track.getCurrentPoint());
097     canvas.addSprite(heart);
098   }
099 
100   /** Creates the picture for the bear to appear on click */
101   public void makePedoAppear()
102   {
103     pedo=new ImageSprite(Wiki.getMedia("Pedobeargif1.gif"));
104     pedo.setLocation(whereClick);
105     pedo.setScale(0.25);
106     canvas.addSprite(pedo);
107   }
108 
109   /** Creates the delay */
110   class PedoAppear implements Alarm
111   {
112     public void alarm()
113     {
114       makePedoAppear();
115       sound3.play();
116     }
117   }
118 
119   /** Creates the stick functions and the on mouse location of the girl */
120   public void advanceFrame(double timePassed)
121   {
122 
123     if (getPlayer().getMouse().getClickLocation() != null)
124     {
125       if (loli.intersects(getPlayer().getMouse().getClickLocation()))
126       {
127         Point2D.Double click=getPlayer().getMouse().getClickLocation();
128         if(click!=null)
129         {
130           scheduleRelative(new PedoAppear()1);
131           whereClick=click;
132           sticker = !sticker;
133           sound1.play();
134         }
135 
136       }
137 
138     }
139     if (sticker == false)
140     {
141       loli.rotate(0.3);
142       loli.setLocation(getPlayer().getMouse().getLocation());
143       canvas.removeSprite(pedo);
144       sound1.stop();
145       sound3.stop();
146     }
147 
148   }
149 
150 }

Compiler Errors:
----------
1. ERROR in NickandChris/InteractiveArt.java (at line 16)
	private OutlineTracker track;
	        ^^^^^^^^^^^^^^
The type OutlineTracker is ambiguous
----------
2. ERROR in NickandChris/InteractiveArt.java (at line 40)
	loli=new ImageSprite(Wiki.getMedia("Lolinew2.gif"));
	     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The constructor ImageSprite(URL) is undefined
----------
9 problems (9 errors)

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