From ggc
|
001 packagepackage is used to name the directory or folder a class is in NickandChris;
002
003 importimport means to make the classes and/or packages available in this program wiki.Wiki;
004 importimport means to make the classes and/or packages available in this program fang.*;
005 importimport means to make the classes and/or packages available in this program java.awt.*;
006 importimport means to make the classes and/or packages available in this program java.awt.geom.*;
007 importimport means to make the classes and/or packages available in this program Beta.*;
008
009 /**
010 * Interactive Art.
011 * @authornull Nmckee and Cgarrett
012 */
013 publicpublic is used to indicate unrestricted access (any other class can have access) classclass is a group of fields and methods used for making objects InteractiveArt extendsextends means to customize or extend the functionality of a class GameLoop
014 {open braces start code blocks and must be matched with a close brace
015 /** Declares variables */
016 privateprivate is used to restrict access to the current class only OutlineTracker track;
017 privateprivate is used to restrict access to the current class only Sprite heart;
018 privateprivate is used to restrict access to the current class only StringSprite title;
019 privateprivate is used to restrict access to the current class only StringSprite author;
020 privateprivate is used to restrict access to the current class only Sprite background;
021 privateprivate is used to restrict access to the current class only Sprite loli;
022 privateprivate is used to restrict access to the current class only Sprite pedo;
023 privateprivate is used to restrict access to the current class only Point2D.Double whereClick;
024 privateprivate is used to restrict access to the current class only Sound sound1;
025 privateprivate is used to restrict access to the current class only Sound sound2;
026 privateprivate is used to restrict access to the current class only Sound sound3;
027 privateprivate is used to restrict access to the current class only booleanboolean is a type that is either true or false sticker =this assignment operator makes the left side equal to the right side falsefalse is a value for the boolean type and means not true;
028
029 /** Starts game */
030 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value startGame()
031 {open braces start code blocks and must be matched with a close brace
032 /** Gives the background the pink color */
033 background=this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor 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=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite(Wiki.getMedia("Lolinew2.gif"));
041 loli.setScale(0.30);
042 loli.setLocation(0.5, 0.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>"+adds two numbers together or concatenates Strings together
055 "Allow the sound clips to completely play.<br><br>"+adds two numbers together or concatenates Strings together
056 "Click her again to unstick her from the background.<br><br>"+adds two numbers together or concatenates Strings together
057 "Enjoy your lolicious art.");
058 }close braces end code blocks and must match an earlier open brace
059
060 /** Creates the title and author text */
061 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makeStrings()
062 {open braces start code blocks and must be matched with a close brace
063 title=this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor 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=this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor 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 }close braces end code blocks and must match an earlier open brace
079
080 /** Creates the sound */
081 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makeSounds()
082 {open braces start code blocks and must be matched with a close brace
083 sound1 =this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Sound(Wiki.getMedia("Lolisound1.wav"));
084 sound3 =this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Sound(Wiki.getMedia("Grunt.wav"));
085 }close braces end code blocks and must match an earlier open brace
086
087 /** Creates the path forfor is a looping structure for repeatedly executing a block of code the heart picture to follow */
088 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makePath()
089 {open braces start code blocks and must be matched with a close brace
090 heart=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite(Wiki.getMedia("Heart1.gif"));
091 heart.setLocation(0.5, 0.5);
092 heart.setScale(0.1);
093 track=this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor OutlineTracker(0.2, 0, 0, 1, 1, 0, 0);
094 track.setLooping(truetrue is the boolean value that is the opposite of false);
095 heart.setTracker(track);
096 heart.setLocation(track.getCurrentPoint());
097 canvas.addSprite(heart);
098 }close braces end code blocks and must match an earlier open brace
099
100 /** Creates the picture forfor is a looping structure for repeatedly executing a block of code the bear to appear on click */
101 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value makePedoAppear()
102 {open braces start code blocks and must be matched with a close brace
103 pedo=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite(Wiki.getMedia("Pedobeargif1.gif"));
104 pedo.setLocation(whereClick);
105 pedo.setScale(0.25);
106 canvas.addSprite(pedo);
107 }close braces end code blocks and must match an earlier open brace
108
109 /** Creates the delay */
110 classclass is a group of fields and methods used for making objects PedoAppear implementsimplements means providing method bodies for the methods declared in the corresponding interface Alarm
111 {open braces start code blocks and must be matched with a close brace
112 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value alarm()
113 {open braces start code blocks and must be matched with a close brace
114 makePedoAppear();
115 sound3.play();
116 }close braces end code blocks and must match an earlier open brace
117 }close braces end code blocks and must match an earlier open brace
118
119 /** Creates the stick functions and the on mouse location of the girl */
120 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value advanceFrame(doubledouble is the type for numbers that can contain decimal fractions timePassed)
121 {open braces start code blocks and must be matched with a close brace
122
123 ifif executes the next statement only if the condition in parenthesis evaluates to true (getPlayer().getMouse().getClickLocation() !=this is the not equals operator which evaluates to true if both sides are different nullnull is the value used to refer to a non-existant object)
124 {open braces start code blocks and must be matched with a close brace
125 ifif executes the next statement only if the condition in parenthesis evaluates to true (loli.intersects(getPlayer().getMouse().getClickLocation()))
126 {open braces start code blocks and must be matched with a close brace
127 Point2D.Double click=this assignment operator makes the left side equal to the right sidegetPlayer().getMouse().getClickLocation();
128 ifif executes the next statement only if the condition in parenthesis evaluates to true(click!=this is the not equals operator which evaluates to true if both sides are differentnullnull is the value used to refer to a non-existant object)
129 {open braces start code blocks and must be matched with a close brace
130 scheduleRelative(newnew is used to create objects by calling the constructor PedoAppear(), 1);
131 whereClick=this assignment operator makes the left side equal to the right sideclick;
132 sticker =this assignment operator makes the left side equal to the right side !this is the not operator, which changes true to false and false to truesticker;
133 sound1.play();
134 }close braces end code blocks and must match an earlier open brace
135
136 }close braces end code blocks and must match an earlier open brace
137
138 }close braces end code blocks and must match an earlier open brace
139 ifif executes the next statement only if the condition in parenthesis evaluates to true (sticker ==this is the comparison operator which evaluates to true if both sides are the same falsefalse is a value for the boolean type and means not true)
140 {open braces start code blocks and must be matched with a close brace
141 loli.rotate(0.3);
142 loli.setLocation(getPlayer().getMouse().getLocation());
143 canvas.removeSprite(pedo);
144 sound1.stop();
145 sound3.stop();
146 }close braces end code blocks and must match an earlier open brace
147
148 }close braces end code blocks and must match an earlier open brace
149
150 }close braces end code blocks and must match an earlier open brace
|
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