From ggc
|
01 packagepackage is used to name the directory or folder a class is in jam;
02
03 importimport means to make the classes and/or packages available in this program wiki.Wiki;
04 importimport means to make the classes and/or packages available in this program fang.*;
05 importimport means to make the classes and/or packages available in this program java.awt.geom.*;
06 /**
07 * All about my classclass is a group of fields and methods used for making objects here.
08 * @authorthis is the Javadoc tag for documenting who created the source code Jam Jenkins
09 */
10 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 RunAwayTracker extendsextends means to customize or extend the functionality of a class ProjectileTracker
11 {open braces start code blocks and must be matched with a close brace
12 privateprivate is used to restrict access to the current class only Sprite villain;
13 privateprivate is used to restrict access to the current class only Sprite goodGuy;
14
15 publicpublic is used to indicate unrestricted access (any other class can have access) RunAwayTracker(doubledouble is the type for numbers that can contain decimal fractions x, doubledouble is the type for numbers that can contain decimal fractions y)
16 {open braces start code blocks and must be matched with a close brace
17 super(x, y);
18 }close braces end code blocks and must match an earlier open brace
19
20 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setVillain(Sprite villain)
21 {open braces start code blocks and must be matched with a close brace
22 thisthis means the current object (the implicit parameter).villain=this assignment operator makes the left side equal to the right sidevillain;
23 }close braces end code blocks and must match an earlier open brace
24
25 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setGoodGuy(Sprite good)
26 {open braces start code blocks and must be matched with a close brace
27 thisthis means the current object (the implicit parameter).goodGuy=this assignment operator makes the left side equal to the right sidegood;
28 }close braces end code blocks and must match an earlier open brace
29
30 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value advanceTime(doubledouble is the type for numbers that can contain decimal fractions timePassed)
31 {open braces start code blocks and must be matched with a close brace
32 super.advanceTime(timePassed);
33 doubledouble is the type for numbers that can contain decimal fractions angle=this assignment operator makes the left side equal to the right sideMath.atan2(
34 goodGuy.getLocation().y-villain.getLocation().y,
35 goodGuy.getLocation().x-villain.getLocation().x);
36 setVelocityDirection(angle);
37 ifif executes the next statement only if the condition in parenthesis evaluates to true(goodGuy.getLocation().distance(villain.getLocation())<0.3)
38 {open braces start code blocks and must be matched with a close brace
39 doubledouble is the type for numbers that can contain decimal fractions speed=this assignment operator makes the left side equal to the right sidegetVelocity().distance(0, 0);
40 ifif executes the next statement only if the condition in parenthesis evaluates to true(speed>0.5)
41 speed=this assignment operator makes the left side equal to the right side0.5;
42 elseelse is what happens when the if condition is false
43 speed*=this multiplies the variable on the left by the value on the right and stores the result in the variable1.05;
44 setVelocity(newnew is used to create objects by calling the constructor Point2D.Double(speed*Math.cos(angle), speed*Math.sin(angle)));
45 }close braces end code blocks and must match an earlier open brace
46 elseelse is what happens when the if condition is false
47 {open braces start code blocks and must be matched with a close brace
48 doubledouble is the type for numbers that can contain decimal fractions speed=this assignment operator makes the left side equal to the right sidegetVelocity().distance(0, 0);
49 ifif executes the next statement only if the condition in parenthesis evaluates to true(speed<0.1)
50 speed=this assignment operator makes the left side equal to the right side0.1;
51 elseelse is what happens when the if condition is false
52 speed*=this multiplies the variable on the left by the value on the right and stores the result in the variable0.98;
53 setVelocity(newnew is used to create objects by calling the constructor Point2D.Double(speed*Math.cos(angle), speed*Math.sin(angle)));
54 }close braces end code blocks and must match an earlier open brace
55 }close braces end code blocks and must match an earlier open brace
56 }close braces end code blocks and must match an earlier open brace
|
Compiler Errors:
----------
1. ERROR in jam/RunAwayTracker.java (at line 30)
public void advanceTime(double timePassed)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Cannot override the final method from Transformer
----------
1 problem (1 error)
Download/View jam/RunAwayTracker.java