From ggc
|
01 importimport means to make the classes and/or packages available in this program fang.*;
02 importimport means to make the classes and/or packages available in this program java.awt.*;
03 importimport means to make the classes and/or packages available in this program java.awt.geom.*;
04 importimport means to make the classes and/or packages available in this program Beta.OutlineTracker;
05
06 /**
07 * All about my game here.
08 * @authorthis is the Javadoc tag for documenting who created the source code Valerie Hagen
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 TravValTracker extendsextends means to customize or extend the functionality of a class GameLoop
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 Point2D.Double whereClick;
13 privateprivate is used to restrict access to the current class only ImageSprite moving;
14 privateprivate is used to restrict access to the current class only OutlineTracker tracker;
15 privateprivate is used to restrict access to the current class only Sound Frog;
16 privateprivate is used to restrict access to the current class only Sprite woof;
17 privateprivate is used to restrict access to the current class only Sprite background;
18
19 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makeDotAppear()
20 {open braces start code blocks and must be matched with a close brace
21 Sprite sprite=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite(1, 1);
22 sprite.setScale(0.1);
23 sprite.setLocation(whereClick);
24 canvas.addSprite(sprite);
25 }close braces end code blocks and must match an earlier open brace
26
27
28 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makeSounds()
29 {open braces start code blocks and must be matched with a close brace
30 Frog=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Sound(Wiki.getMedia("Frog.wav"));
31 }close braces end code blocks and must match an earlier open brace
32
33
34 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value startGame()
35 {open braces start code blocks and must be matched with a close brace
36
37 background=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(4);
38 background.setScale(2);
39 background.setColor(Color.RED);
40 background.setLocation(.5,.5);
41 canvas.addSprite(background);
42
43 woof=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("woof!");
44 woof.setLocation(0.5, 0.5);
45 canvas.addSprite(woof);
46
47 makeSounds();
48 toggleAudible();
49 moving=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite(Wiki.getMedia("Dog.gif"));
50 moving.setScale(0.2);
51 moving.setLocation(0.5, 0.5);
52 canvas.addSprite(moving);
53
54 Sprite square=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(5);
55 square.setScale(0.5);
56 square.setLocation(0.5, 0.5);
57
58 Sprite smallCircle=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(3);
59 smallCircle.setScale(0.1);
60 OutlineTracker small=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OutlineTracker(smallCircle, 0.6);
61 small.setLooping(truetrue is the boolean value that is the opposite of false);
62
63 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);
64 ProjectileTracker pTracker=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ProjectileTracker(direction);
65 pTracker.setAngularVelocity(1);
66 tracker=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OutlineTracker(square, 0.2);
67 CompositeTracker composite=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor CompositeTracker();
68 composite.addTracker(tracker);
69 composite.addTracker(small);
70 composite.addTracker(pTracker);
71 moving.setLocation(tracker.getCurrentPoint());
72 moving.setTracker(composite);
73 tracker.setLooping(truetrue is the boolean value that is the opposite of false);
74 }close braces end code blocks and must match an earlier open brace
75
76
77 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)
78 {open braces start code blocks and must be matched with a close brace
79
80 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 differentnullnull is the value used to refer to a non-existant object)
81 {open braces start code blocks and must be matched with a close brace
82 moving.setScale(random.nextDouble());
83 Frog.play();
84 }close braces end code blocks and must match an earlier open brace
85 }close braces end code blocks and must match an earlier open brace
86
87 classclass is a group of fields and methods used for making objects SoundPlay implementsimplements means providing method bodies for the methods declared in the corresponding interface Alarm
88 {open braces start code blocks and must be matched with a close brace
89 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value alarm()
90 {open braces start code blocks and must be matched with a close brace
91 Frog.play();
92 }close braces end code blocks and must match an earlier open brace
93 }close braces end code blocks and must match an earlier open brace
94
95
96 }close braces end code blocks and must match an earlier open brace
|
Compiler Errors:
----------
1. ERROR in TravValTracker.java (at line 49)
moving=new ImageSprite(Wiki.getMedia("Dog.gif"));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The constructor ImageSprite(URL) is undefined
----------
1 problem (1 error)
Download/View TravValTracker.java