|
001 packagepackage is used to name the directory or folder a class is in matt_mitrovich_kcie_green;
002
003 importimport means to make the classes and/or packages available in this program fang.*;
004 importimport means to make the classes and/or packages available in this program java.awt.*;
005 importimport means to make the classes and/or packages available in this program java.awt.geom.*;
006
007 /**
008 * All about my game.
009 * @authorthis is the Javadoc tag for documenting who created the source code My Name Here
010 */
011 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 InteractiveArt extendsextends means to customize or extend the functionality of a class Game
012 {open braces start code blocks and must be matched with a close brace
013 privateprivate is used to restrict access to the current class only RectangleSprite help;
014 privateprivate is used to restrict access to the current class only RectangleSprite help2;
015 privateprivate is used to restrict access to the current class only ImageSprite ball;
016 privateprivate is used to restrict access to the current class only ProjectileTransformer projectile;
017 privateprivate is used to restrict access to the current class only OutlineSprite border;
018 privateprivate is used to restrict access to the current class only PolygonSprite poly;
019 privateprivate is used to restrict access to the current class only OvalSprite circle;
020
021
022
023 /**sets up the game*/
024 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setup()
025 {open braces start code blocks and must be matched with a close brace
026 square();
027 spinnyThing();
028 }close braces end code blocks and must match an earlier open brace
029 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value square()
030 {open braces start code blocks and must be matched with a close brace
031 poly=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(0.01, 0.15, 0.99, 0.15, 0.99, 0.99, 0.01, 0.99);
032 border=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OutlineSprite(poly);
033 border.setSize(0.99);
034 border.setLineThickness(0.05);
035 border.setLocation(0.5, 0.55);
036 border.setColor(Palette.getColor("pink"));
037 addSprite(border);
038 }close braces end code blocks and must match an earlier open brace
039 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value helpDesk()
040 {open braces start code blocks and must be matched with a close brace
041
042 String helpText=this assignment operator makes the left side equal to the right side
043 "sup<br>"+adds two numbers together or concatenates Strings together
044 "y do u need help<br>"+adds two numbers together or concatenates Strings together
045 "its only a spinning square.";
046 setHelpText(helpText);
047 }close braces end code blocks and must match an earlier open brace
048
049 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value spinnyThing()
050 {open braces start code blocks and must be matched with a close brace
051
052 help=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor RectangleSprite(1,1);
053 help.setSize(.15);
054 help.setLocation(0.25,0.50);
055 help.setColor(Palette.getColor("Orange"));
056 addSprite(help);
057
058 circle=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite(0.5, 0.5);
059 circle.setSize(.25);
060 circle.setLocation(0.5, 0.5);
061 circle.setColor(Palette.getColor("midnightblue"));
062 canvas.addSprite(circle);
063
064 help2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor RectangleSprite(1,1);
065 help2.setSize(.15);
066 help2.setLocation(0.75,0.50);
067 help2.setColor(Palette.getColor("red"));
068 addSprite(help2);
069 {open braces start code blocks and must be matched with a close brace}close braces end code blocks and must match an earlier open brace
070
071
072 ball=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("Ssth.png");
073 ball.setLocation(0.5, 0.25);
074 ball.setSize(.1);
075 addSprite(ball);
076
077 projectile=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ProjectileTransformer(1, 2);
078 ball.addTransformer(projectile);
079
080
081
082 //* Creating a spin transformer*/
083 Spinner spinner;
084 spinner=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Spinner(0);
085 spinner.setRotationDegrees(360);
086
087 //* Adds rotation to cube*/
088 help.addTransformer(spinner);
089 help2.addTransformer(spinner);
090
091 //* Make the circle blink*/
092 schedule(newnew is used to create objects by calling the constructor Blinker(), 0.5);
093
094 }close braces end code blocks and must match an earlier open brace
095
096
097
098
099
100 //* Recipe for collesions*//
101 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value handleCollisions()
102 {open braces start code blocks and must be matched with a close brace
103 ball.bounceOffOf(help);
104 ball.bounceOffOf(help2);
105 ball.bounceOffOf(border);
106
107 }close braces end code blocks and must match an earlier open brace
108
109 //* Makes the blue circle blink*/
110 classclass is a group of fields and methods used for making objects Blinker extendsextends means to customize or extend the functionality of a class TimedAction
111 {open braces start code blocks and must be matched with a close brace
112 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value act()
113 {open braces start code blocks and must be matched with a close brace
114 booleanboolean is a type that is either true or false vis=this assignment operator makes the left side equal to the right sidecircle.isVisible();
115 circle.setVisible(!this is the not operator, which changes true to false and false to truevis);
116 schedule(thisthis means the current object (the implicit parameter), .7);
117 }close braces end code blocks and must match an earlier open brace
118 }close braces end code blocks and must match an earlier open brace
119
120
121 /**handle input and game events*/
122 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value advance()
123 {open braces start code blocks and must be matched with a close brace
124 handleCollisions();
125
126 }close braces end code blocks and must match an earlier open brace
127 }close braces end code blocks and must match an earlier open brace
|