From ggc
|
001 packagepackage is used to name the directory or folder a class is in jam;
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 fang2.*;
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 Jam Jenkins
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 MyMasterpiece extendsextends means to customize or extend the functionality of a class GameLoop
013 {open braces start code blocks and must be matched with a close brace
014 /**an oval*/
015 privateprivate is used to restrict access to the current class only intint is the type for whole numbers and it is short for integer stage=this assignment operator makes the left side equal to the right side0;
016 privateprivate is used to restrict access to the current class only Sound sound=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Sound("DingLower.wav");
017 privateprivate is used to restrict access to the current class only StringSprite spin;
018 privateprivate is used to restrict access to the current class only ProjectileTracker tracker;
019
020 /**sets up the game*/
021 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value startGame()
022 {open braces start code blocks and must be matched with a close brace
023 setHelpText("Information about my art\nwill go here.");
024
025 StringSprite signature=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("by Jam Jenkins");
026 signature.setLineHeight(0.1);
027 signature.leftJustify();
028 signature.bottomJustify();
029 signature.setLocation(0.01, 1);
030 canvas.addSprite(signature);
031
032 StringSprite title=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Masterpiece");
033 title.setFontFamilyName("Algerian");
034 title.setColor(Color.YELLOW);
035 title.topJustify();
036 title.setWidth(0.9);
037 title.setLocation(0.5, 0.01);
038 canvas.addSprite(title);
039 }close braces end code blocks and must match an earlier open brace
040
041 /**makes the sprites*/
042 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makeSprites()
043 {open braces start code blocks and must be matched with a close brace
044 spin=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Jelly\nDonut");
045 spin.setScale(0.25);
046 spin.setLocation(0.5, 0.5);
047
048 tracker=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ProjectileTracker(
049 random.nextDouble()-0.5,
050 random.nextDouble()-0.5);
051 tracker.setAngularVelocity(1);
052 spin.setTracker(tracker);
053 }close braces end code blocks and must match an earlier open brace
054
055
056 /**adds the sprites to the screen*/
057 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value addSprites()
058 {open braces start code blocks and must be matched with a close brace
059 canvas.addSprite(spin);
060 }close braces end code blocks and must match an earlier open brace
061
062
063 classclass is a group of fields and methods used for making objects GoAway implementsimplements means providing method bodies for the methods declared in the corresponding interface Alarm
064 {open braces start code blocks and must be matched with a close brace
065 intint is the type for whole numbers and it is short for integer timesToExecute=this assignment operator makes the left side equal to the right side70;
066
067 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value alarm()
068 {open braces start code blocks and must be matched with a close brace
069 timesToExecute--this is the decrement operator, which decreases the variable by 1;
070 fade();
071 ifif executes the next statement only if the condition in parenthesis evaluates to true(timesToExecute>0 &this performs a bit-wise and (not the same as boolean and which is &&)&this performs a bit-wise and (not the same as boolean and which is &&) getPlayer().getKeyboard().getLastKey()!=this is the not equals operator which evaluates to true if both sides are different's')
072 scheduleRelative(thisthis means the current object (the implicit parameter), 0.1);
073 elseelse is what happens when the if condition is false
074 {open braces start code blocks and must be matched with a close brace
075 canvas.removeAllSprites();
076 startStage1();
077 }close braces end code blocks and must match an earlier open brace
078 }close braces end code blocks and must match an earlier open brace
079 }close braces end code blocks and must match an earlier open brace
080
081 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value startStage1()
082 {open braces start code blocks and must be matched with a close brace
083 System.out.println("Stage 1 starting");
084 makeSprites();
085 addSprites();
086 stage=this assignment operator makes the left side equal to the right side1;
087 }close braces end code blocks and must match an earlier open brace
088
089 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value fade()
090 {open braces start code blocks and must be matched with a close brace
091 Sprite[brackets are typically used to declare, initialize and index (indicate which element of) arrays]brackets are typically used to declare, initialize and index (indicate which element of) arrays all=this assignment operator makes the left side equal to the right sidecanvas.getAllSprites();
092 forfor is a looping structure for repeatedly executing a block of code(Sprite single: all)
093 {open braces start code blocks and must be matched with a close brace
094 Color color=this assignment operator makes the left side equal to the right sidesingle.getColor();
095 single.setColor(newnew is used to create objects by calling the constructor Color(color.getRed(), color.getGreen(),
096 color.getBlue(),
097 Math.max(0, color.getAlpha()-4)));
098 }close braces end code blocks and must match an earlier open brace
099 }close braces end code blocks and must match an earlier open brace
100
101 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value doStage0()
102 {open braces start code blocks and must be matched with a close brace
103 Point2D.Double click=this assignment operator makes the left side equal to the right sidegetPlayer().getMouse().getClickLocation();
104 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)
105 {open braces start code blocks and must be matched with a close brace
106 scheduleRelative(newnew is used to create objects by calling the constructor GoAway(), 1);
107 sound.play(click.x);
108 stage=this assignment operator makes the left side equal to the right side-1;
109 }close braces end code blocks and must match an earlier open brace
110 }close braces end code blocks and must match an earlier open brace
111
112 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value doStage1()
113 {open braces start code blocks and must be matched with a close brace
114 ifif executes the next statement only if the condition in parenthesis evaluates to true(spin.getLocation().y>1 ||this is boolean or, meaning if either or both are true then the result is true spin.getLocation().y<0)
115 {open braces start code blocks and must be matched with a close brace
116 Point2D.Double direction=this assignment operator makes the left side equal to the right sidetracker.getVelocity();
117 direction.y*=this multiplies the variable on the left by the value on the right and stores the result in the variable-1;
118 tracker.setVelocity(direction);
119 tracker.setAngularVelocity(-tracker.getAngularVelocity());
120 }close braces end code blocks and must match an earlier open brace
121 ifif executes the next statement only if the condition in parenthesis evaluates to true(spin.getLocation().x>1 ||this is boolean or, meaning if either or both are true then the result is true spin.getLocation().x<0)
122 {open braces start code blocks and must be matched with a close brace
123 Point2D.Double direction=this assignment operator makes the left side equal to the right sidetracker.getVelocity();
124 direction.x*=this multiplies the variable on the left by the value on the right and stores the result in the variable-1;
125 tracker.setVelocity(direction);
126 tracker.setAngularVelocity(-tracker.getAngularVelocity());
127 }close braces end code blocks and must match an earlier open brace
128 Point2D.Double leftClick=this assignment operator makes the left side equal to the right sidegetPlayer().getMouse().getLeftClickLocation();
129 Point2D.Double rightClick=this assignment operator makes the left side equal to the right sidegetPlayer().getMouse().getRightClickLocation();
130 ifif executes the next statement only if the condition in parenthesis evaluates to true(leftClick!=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)
131 spin.scale(1.05);
132 ifif executes the next statement only if the condition in parenthesis evaluates to true(rightClick!=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)
133 spin.scale(0.95);
134 }close braces end code blocks and must match an earlier open brace
135
136 /**handle input and game events*/
137 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)
138 {open braces start code blocks and must be matched with a close brace
139 ifif executes the next statement only if the condition in parenthesis evaluates to true(stage==this is the comparison operator which evaluates to true if both sides are the same0)
140 {open braces start code blocks and must be matched with a close brace
141 doStage0();
142 }close braces end code blocks and must match an earlier open brace
143 ifif executes the next statement only if the condition in parenthesis evaluates to true(stage==this is the comparison operator which evaluates to true if both sides are the same1)
144 {open braces start code blocks and must be matched with a close brace
145 doStage1();
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
|
Compiler Errors:
----------
1. ERROR in jam/MyMasterpiece.java (at line 18)
private ProjectileTracker tracker;
^^^^^^^^^^^^^^^^^
ProjectileTracker cannot be resolved to a type
----------
2. ERROR in jam/MyMasterpiece.java (at line 48)
tracker=new ProjectileTracker(
^^^^^^^
tracker cannot be resolved
----------
13 problems (13 errors)
Download/View jam/MyMasterpiece.java