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.Graphics2D;
06 importimport means to make the classes and/or packages available in this program java.awt.Shape;
07 importimport means to make the classes and/or packages available in this program java.awt.geom.AffineTransform;
08 importimport means to make the classes and/or packages available in this program java.awt.geom.Point2D;
09 importimport means to make the classes and/or packages available in this program java.awt.geom.Rectangle2D;
10
11 /**
12 * All about my classclass is a group of fields and methods used for making objects here.
13 * @authorthis is the Javadoc tag for documenting who created the source code Jam Jenkins
14 */
15 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 Sprite3D extendsextends means to customize or extend the functionality of a class Sprite
16 {open braces start code blocks and must be matched with a close brace
17 publicpublic is used to indicate unrestricted access (any other class can have access) staticstatic means that an instance is not required for access (class level access) doubledouble is the type for numbers that can contain decimal fractions viewingAngle=this assignment operator makes the left side equal to the right sideMath.atan(0.1)*2;
18 publicpublic is used to indicate unrestricted access (any other class can have access) staticstatic means that an instance is not required for access (class level access) doubledouble is the type for numbers that can contain decimal fractions screenSizeFactor=this assignment operator makes the left side equal to the right sideMath.tan(viewingAngle/2)*2;
19 publicpublic is used to indicate unrestricted access (any other class can have access) staticstatic means that an instance is not required for access (class level access) Point2D.Double center=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Point2D.Double(0.5, 0.5);
20 doubledouble is the type for numbers that can contain decimal fractions layer=this assignment operator makes the left side equal to the right side1;
21 doubledouble is the type for numbers that can contain decimal fractions cachedScale=this assignment operator makes the left side equal to the right side1;
22 booleanboolean is a type that is either true or false layerChanged;
23 AffineTransform layerTransform;
24 publicpublic is used to indicate unrestricted access (any other class can have access) Sprite3D(Shape shape)
25 {open braces start code blocks and must be matched with a close brace
26 super(shape);
27 layerChanged=this assignment operator makes the left side equal to the right sidefalsefalse is a value for the boolean type and means not true;
28 layerTransform=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor AffineTransform();
29 }close braces end code blocks and must match an earlier open brace
30
31 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setScale(doubledouble is the type for numbers that can contain decimal fractions scale)
32 {open braces start code blocks and must be matched with a close brace
33 cachedScale=this assignment operator makes the left side equal to the right sidescale;
34 super.setScale(scale);
35 }close braces end code blocks and must match an earlier open brace
36
37 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value scale(doubledouble is the type for numbers that can contain decimal fractions scalingFactor)
38 {open braces start code blocks and must be matched with a close brace
39 cachedScale*=this multiplies the variable on the left by the value on the right and stores the result in the variablescalingFactor;
40 super.scale(scalingFactor);
41 }close braces end code blocks and must match an earlier open brace
42
43 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setLayer(doubledouble is the type for numbers that can contain decimal fractions layer)
44 {open braces start code blocks and must be matched with a close brace
45 ifif executes the next statement only if the condition in parenthesis evaluates to true(thisthis means the current object (the implicit parameter).layer!=this is the not equals operator which evaluates to true if both sides are differentlayer)
46 layerChanged=this assignment operator makes the left side equal to the right sidetruetrue is the boolean value that is the opposite of false;
47 thisthis means the current object (the implicit parameter).layer=this assignment operator makes the left side equal to the right sidelayer;
48 ifif executes the next statement only if the condition in parenthesis evaluates to true(layer<=this evaluates to true if the left side is not more than the right side0) returnreturn means to provide the result of the method and/or cease execution of the method immediately;
49 }close braces end code blocks and must match an earlier open brace
50
51 publicpublic is used to indicate unrestricted access (any other class can have access) doubledouble is the type for numbers that can contain decimal fractions getLayer()
52 {open braces start code blocks and must be matched with a close brace
53 returnreturn means to provide the result of the method and/or cease execution of the method immediately layer;
54 }close braces end code blocks and must match an earlier open brace
55
56 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value adjustViewingAngle()
57 {open braces start code blocks and must be matched with a close brace
58 doubledouble is the type for numbers that can contain decimal fractions visibleSize=this assignment operator makes the left side equal to the right sidecachedScale;
59 doubledouble is the type for numbers that can contain decimal fractions screenSize=this assignment operator makes the left side equal to the right sidescreenSizeFactor*(5-layer);
60 doubledouble is the type for numbers that can contain decimal fractions scale=this assignment operator makes the left side equal to the right sidevisibleSize/screenSize;
61 layerTransform.setTransform(
62 scale, 0,
63 0, scale,
64 center.x-scale*center.x,
65 center.y-scale*center.y);
66 }close braces end code blocks and must match an earlier open brace
67
68 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value paint(Graphics2D brush)
69 {open braces start code blocks and must be matched with a close brace
70 ifif executes the next statement only if the condition in parenthesis evaluates to true(layer>5) returnreturn means to provide the result of the method and/or cease execution of the method immediately;
71 ifif executes the next statement only if the condition in parenthesis evaluates to true(layerChanged) adjustViewingAngle();
72 AffineTransform original=this assignment operator makes the left side equal to the right sidebrush.getTransform();
73 brush.transform(layerTransform);
74 super.paint(brush);
75 brush.setTransform(original);
76 }close braces end code blocks and must match an earlier open brace
77 }close braces end code blocks and must match an earlier open brace
|
Download/View Jam/Sprite3D.java