From ggc
|
001 importimport means to make the classes and/or packages available in this program fang.*;
002 importimport means to make the classes and/or packages available in this program java.awt.*;
003 importimport means to make the classes and/or packages available in this program java.awt.geom.*;
004 importimport means to make the classes and/or packages available in this program Beta.OutlineTracker;
005
006 /**
007 * All about my game here.
008 * @authorthis is the Javadoc tag for documenting who created the source code Merima Omanovic and Kim Mooney
009 */
010 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 MerimaKimInteractiveArt extendsextends means to customize or extend the functionality of a class GameLoop
011 {open braces start code blocks and must be matched with a close brace
012 privateprivate is used to restrict access to the current class only Sprite background;
013 /**text*/
014 privateprivate is used to restrict access to the current class only Sprite title;
015 privateprivate is used to restrict access to the current class only Sprite names;
016 /**shapes*/
017 privateprivate is used to restrict access to the current class only Sprite triangle;
018 privateprivate is used to restrict access to the current class only Sprite square;
019 /**sprite to move*/
020 privateprivate is used to restrict access to the current class only Sprite sprite;
021 /**tracker to move the sprite*/
022 privateprivate is used to restrict access to the current class only OutlineTracker tracker;
023 privateprivate is used to restrict access to the current class only Sprite outline;
024 privateprivate is used to restrict access to the current class only ProjectileTracker track;
025 /**alarm*/
026 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;
027 privateprivate is used to restrict access to the current class only Sound sound;
028
029 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value startGame()
030 {open braces start code blocks and must be matched with a close brace
031 makeSprites();
032 addSprites();
033 setupAlarm( 1 ) ;
034 toggleAudible();
035
036 }close braces end code blocks and must match an earlier open brace
037
038 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makeSprites()
039 {open braces start code blocks and must be matched with a close brace
040 /**background picture**/
041 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"));
042 background.setScale(1.75);
043 background.setLocation(0.5, 0.5);
044
045 /**text: title and the names*/
046 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");
047 title.setScale(.30);
048 title.setLocation(0.5, 0.05);
049 title.setColor(Color.BLACK);
050 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");
051 names.setScale(.25);
052 names.setLocation(0.5, 0.1);
053 names.setColor(Color.BLACK);
054
055 /**shapes:big triangle, square, small triangle*/
056 triangle=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(3);
057 triangle.setScale(.8);
058 triangle.setLocation(0.5, 0.5);
059 triangle.setColor(Color.BLACK);
060
061 square=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(4);
062 square.setScale(0.2);
063 square.setColor(Color.WHITE);
064 square.setLocation(0.5, 0.5);
065
066 sprite=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(3);
067 sprite.setScale(0.1);
068 sprite.setLocation(0.5, 0.5);
069 sprite.setColor(Color.WHITE);
070 sprite.setBlurLength(25);
071
072 /**outline*/
073 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);
074 outline.setScale(0.5);
075 outline.setLocation(0.5, 0.5);
076 outline.setColor(Color.BLACK);
077 canvas.addSprite(outline);
078
079 /**outline tracker*/
080 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);
081 sprite.setTracker(tracker);
082 sprite.setLocation(tracker.getCurrentPoint());
083
084 /**the triangle continues to move around the big triangle*/
085 tracker.setLooping(truetrue is the boolean value that is the opposite of false);
086 /**rotate*/
087 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);
088 track=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor 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 }close braces end code blocks and must match an earlier open brace
095
096 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makeSounds()
097 {open braces start code blocks and must be matched with a close brace
098 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"));
099 sound.play(0.25);
100 }close braces end code blocks and must match an earlier open brace
101
102 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value addSprites()
103 {open braces start code blocks and must be matched with a close brace
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 }close braces end code blocks and must match an earlier open brace
112 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)
113 {open braces start code blocks and must be matched with a close brace
114 Point2D.Double click=this assignment operator makes the left side equal to the right sidegetPlayer().getMouse().getClickLocation();
115 //did they click at all
116 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)
117 {open braces start code blocks and must be matched with a close brace
118 ifif executes the next statement only if the condition in parenthesis evaluates to true(square.intersects(click))
119 {open braces start code blocks and must be matched with a close brace
120 canvas.removeSprite(square);
121 }close braces end code blocks and must match an earlier open brace
122 }close braces end code blocks and must match an earlier open brace
123 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')
124 {open braces start code blocks and must be matched with a close brace
125 sprite.setColor(Color.BLUE);
126 }close braces end code blocks and must match an earlier open brace
127 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')
128 {open braces start code blocks and must be matched with a close brace
129 sprite.setColor(Color.RED);
130 }close braces end code blocks and must match an earlier open brace
131 }close braces end code blocks and must match an earlier open brace
132 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 )
133 {open braces start code blocks and must be matched with a close brace
134 scheduleRelative(newnew is used to create objects by calling the constructor MyAlarm( ), time ) ;
135 }close braces end code blocks and must match an earlier open brace
136
137 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
138 {open braces start code blocks and must be matched with a close brace
139 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value alarm( )
140 {open braces start code blocks and must be matched with a close brace
141 triangle.setVisible( !this is the not operator, which changes true to false and false to truetriangle.isVisible( ) ) ;
142 scheduleRelative( thisthis means the current object (the implicit parameter), 2 ) ;
143 }close braces end code blocks and must match an earlier open brace
144 }close braces end code blocks and must match an earlier open brace
145 }close braces end code blocks and must match an earlier open brace
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