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.*;
06 importimport means to make the classes and/or packages available in this program java.awt.geom.*;
07
08 /**
09 * All about my game here.
10 * @authornull Jam Jenkins
11 */
12 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 TrackerExample extendsextends means to customize or extend the functionality of a class GameLoop
13 {open braces start code blocks and must be matched with a close brace
14 privateprivate is used to restrict access to the current class only Sprite moving;
15 privateprivate is used to restrict access to the current class only ProjectileTracker tracker;
16
17 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value startGame()
18 {open braces start code blocks and must be matched with a close brace
19 moving=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(7);
20 moving.setScale(0.2);
21 moving.setLocation(0.5, 0.5);
22 canvas.addSprite(moving);
23
24 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.2);
25 tracker=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ProjectileTracker(direction);
26 moving.setTracker(tracker);
27 }close braces end code blocks and must match an earlier open brace
28 }close braces end code blocks and must match an earlier open brace
|
Download/View Jam/TrackerExample.java