From ggc
|
001 packagepackage is used to name the directory or folder a class is in MerimaKim;
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
008 /**
009 * All about my game here.
010 * @authorthis is the Javadoc tag for documenting who created the source code Merima Omanovic
011 */
012 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
013
014 {open braces start code blocks and must be matched with a close brace
015 privateprivate is used to restrict access to the current class only Sprite background;
016 /**text*/
017 privateprivate is used to restrict access to the current class only Sprite title;
018 privateprivate is used to restrict access to the current class only Sprite names;
019 /**shapes*/
020 privateprivate is used to restrict access to the current class only Sprite triangle;
021 privateprivate is used to restrict access to the current class only Sprite square;
022 /**sprite to move*/
023 privateprivate is used to restrict access to the current class only Sprite sprite;
024 /**tracker to move the sprite*/
025 privateprivate is used to restrict access to the current class only OutlineTracker tracker;
026 privateprivate is used to restrict access to the current class only Sprite outline;
027 privateprivate is used to restrict access to the current class only ProjectileTracker track;
028 /**alarm*/
029 privateprivate is used to restrict access to the current class only intint is the type for whole numbers and it is short for integer timeLeft;
030 privateprivate is used to restrict access to the current class only Sound sound;
031
032 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value startGame()
033 {open braces start code blocks and must be matched with a close brace
034 makeSprites();
035 addSprites();
036 setupAlarm( 1 ) ;
037 toggleAudible();
038
039 }close braces end code blocks and must match an earlier open brace
040
041 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makeSprites()
042 {open braces start code blocks and must be matched with a close brace
043 /**background picture**/
044 background=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite(Wiki.getMedia("BG2.jpg"));
045 background.setScale(1.75);
046 background.setLocation(0.5, 0.5);
047
048 /**text: title and the names*/
049 title=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Interactive Art");
050 title.setScale(.30);
051 title.setLocation(0.5, 0.05);
052 title.setColor(Color.BLACK);
053 names=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("By: Merima and Kim");
054 names.setScale(.25);
055 names.setLocation(0.5, 0.1);
056 names.setColor(Color.BLACK);
057
058 /**shapes:big triangle, square, small triangle*/
059 triangle=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(3);
060 triangle.setScale(.8);
061 triangle.setLocation(0.5, 0.5);
062 triangle.setColor(Color.BLACK);
063
064 square=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(4);
065 square.setScale(0.2);
066 square.setColor(Color.WHITE);
067 square.setLocation(0.5, 0.5);
068
069 sprite=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(3);
070 sprite.setScale(0.1);
071 sprite.setLocation(0.5, 0.5);
072 sprite.setColor(Color.WHITE);
073 sprite.setBlurLength(25);
074
075 /**outline*/
076 Sprite outline=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(3);
077 outline.setScale(0.5);
078 outline.setLocation(0.5, 0.5);
079 outline.setColor(Color.BLACK);
080 canvas.addSprite(outline);
081
082 /**outline tracker*/
083 tracker=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor 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(truetrue is the boolean value that is the opposite of false);
089 /**rotate*/
090 Point2D.Double direction=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Point2D.Double(0.0, 0.0);
091 track=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor 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 }close braces end code blocks and must match an earlier open brace
098
099 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makeSounds()
100 {open braces start code blocks and must be matched with a close brace
101 sound=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Sound(Wiki.getMedia("Ding.wav"));
102 sound.play(0.25);
103 }close braces end code blocks and must match an earlier open brace
104
105 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value addSprites()
106 {open braces start code blocks and must be matched with a close brace
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 }close braces end code blocks and must match an earlier open brace
115 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)
116 {open braces start code blocks and must be matched with a close brace
117 Point2D.Double click=this assignment operator makes the left side equal to the right sidegetPlayer().getMouse().getClickLocation();
118 //did they click at all
119 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)
120 {open braces start code blocks and must be matched with a close brace
121 ifif executes the next statement only if the condition in parenthesis evaluates to true(square.intersects(click))
122 {open braces start code blocks and must be matched with a close brace
123 canvas.removeSprite(square);
124 }close braces end code blocks and must match an earlier open brace
125 }close braces end code blocks and must match an earlier open brace
126 ifif executes the next statement only if the condition in parenthesis evaluates to true(getPlayer().getKeyboard().getLastKey()==this is the comparison operator which evaluates to true if both sides are the same'e')
127 {open braces start code blocks and must be matched with a close brace
128 sprite.setColor(Color.BLUE);
129 }close braces end code blocks and must match an earlier open brace
130 ifif executes the next statement only if the condition in parenthesis evaluates to true(getPlayer().getKeyboard().getLastKey()==this is the comparison operator which evaluates to true if both sides are the same'r')
131 {open braces start code blocks and must be matched with a close brace
132 sprite.setColor(Color.RED);
133 }close braces end code blocks and must match an earlier open brace
134 }close braces end code blocks and must match an earlier open brace
135 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value setupAlarm( doubledouble is the type for numbers that can contain decimal fractions time )
136 {open braces start code blocks and must be matched with a close brace
137 scheduleRelative(newnew is used to create objects by calling the constructor MyAlarm( ), time ) ;
138 }close braces end code blocks and must match an earlier open brace
139
140 privateprivate is used to restrict access to the current class only classclass is a group of fields and methods used for making objects MyAlarm implementsimplements means providing method bodies for the methods declared in the corresponding interface Alarm
141 {open braces start code blocks and must be matched with a close brace
142 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value alarm( )
143 {open braces start code blocks and must be matched with a close brace
144 triangle.setVisible( !this is the not operator, which changes true to false and false to truetriangle.isVisible( ) ) ;
145 scheduleRelative( thisthis means the current object (the implicit parameter), 2 ) ;
146 }close braces end code blocks and must match an earlier open brace
147 }close braces end code blocks and must match an earlier open brace
148 }close braces end code blocks and must match an earlier open brace
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