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
05 /**
06 * All about my game here.
07 * @authorthis is the Javadoc tag for documenting who created the source code Jam Jenkins
08 */
09 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 RotateExample extendsextends means to customize or extend the functionality of a class GameLoop
10 {open braces start code blocks and must be matched with a close brace
11 /**an oval*/
12 privateprivate is used to restrict access to the current class only Sprite oval;
13 privateprivate is used to restrict access to the current class only ProjectileTracker track;
14 /**sets up the game*/
15 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value startGame()
16 {open braces start code blocks and must be matched with a close brace
17 makeSprites();
18 addSprites();
19 setHelpText("watch it rotate");
20 }close braces end code blocks and must match an earlier open brace
21
22 /**makes the sprites*/
23 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makeSprites()
24 {open braces start code blocks and must be matched with a close brace
25 oval=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite(2, 1);
26 oval.setScale(0.75);
27 oval.setLocation(0.5, 0.5);
28 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);
29 track=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ProjectileTracker(direction);
30 /**rotate 1/2 a revolution per second*/
31 track.setAngularVelocity(3.14);
32 oval.setTracker(track);
33 }close braces end code blocks and must match an earlier open brace
34
35 /**adds the sprites to the screen*/
36 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value addSprites()
37 {open braces start code blocks and must be matched with a close brace
38 canvas.addSprite(oval);
39 }close braces end code blocks and must match an earlier open brace
40 }close braces end code blocks and must match an earlier open brace
|
Download/View RotateExample.java