|
001 packagepackage is used to name the directory or folder a class is in JacobTyler;
002
003 importimport means to make the classes and/or packages available in this program wiki.Wiki;
004 importimport means to make the classes and/or packages available in this program fang.*;
005 importimport means to make the classes and/or packages available in this program java.awt.*;
006 importimport means to make the classes and/or packages available in this program java.awt.geom.*;
007 //makes it so I can add movement to my game
008 importimport means to make the classes and/or packages available in this program Beta.OutlineTracker;
009
010 /**
011 * All about my game here.
012 * @authorthis is the Javadoc tag for documenting who created the source code Jolson
013 */
014 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 GameLoop
015 {open braces start code blocks and must be matched with a close brace
016 //the sprites of my game
017 privateprivate is used to restrict access to the current class only Sprite start, box1, outline, names, title;
018 //the images
019 privateprivate is used to restrict access to the current class only ImageSprite background;
020 //adds a outline to my game
021 privateprivate is used to restrict access to the current class only OutlineTracker tracker;
022 //adds the rotation of sprite
023 privateprivate is used to restrict access to the current class only ProjectileTracker spin;
024 //sets up the stages
025 privateprivate is used to restrict access to the current class only intint is the type for whole numbers and it is short for integer clickCount;
026 privateprivate is used to restrict access to the current class only Sound sound=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Sound(Wiki.getMedia("Ding1.wav"));
027
028 //makes the sprites that I need
029 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value startGame()
030 {open braces start code blocks and must be matched with a close brace
031 makeSprite();
032 toggleAudible();
033 pauseToggle();
034 clickCount=this assignment operator makes the left side equal to the right side0;
035 setHelpText("Press either q, w, or e to change the color."+adds two numbers together or concatenates Strings together
036 "Click to randomly change the size of the triangle."+adds two numbers together or concatenates Strings together
037 "Do not double click at the start or it will freeze!!");
038 }close braces end code blocks and must match an earlier open brace
039
040 //starts game
041 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value makeSprite()
042 {open braces start code blocks and must be matched with a close brace
043 createOutline();
044 createBackground();
045 createStart();
046 createNames();
047 createTitle();
048 }close braces end code blocks and must match an earlier open brace
049
050 //sets the path of the sprites I want to move
051 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value createOutline()
052 {open braces start code blocks and must be matched with a close brace
053 outline=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor RectangleSprite(1,1);
054 outline.setScale(.25);
055 outline.setLocation(.5,.5);
056 canvas.addSprite(outline);
057 }close braces end code blocks and must match an earlier open brace
058
059 //this set the background of the game
060 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value createBackground()
061 {open braces start code blocks and must be matched with a close brace
062 background=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite(Wiki.getMedia("SandBackground.jpg"));
063 background.setScale(1);
064 background.setLocation(.5,.5);
065 canvas.addSprite(background);
066 }close braces end code blocks and must match an earlier open brace
067
068 //this is the string sprite that tells the player how to start playing the game
069 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value createStart()
070 {open braces start code blocks and must be matched with a close brace
071 start=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Click to Start");
072 start.setScale(.7);
073 start.setLocation(.5,.6);
074 start.setColor(Color.RED);
075 canvas.addSprite(start);
076
077 Point2D.Double rotate=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);
078 spin=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ProjectileTracker(rotate);
079 spin.setAngularVelocity(1);
080 start.setTracker(spin);
081 }close braces end code blocks and must match an earlier open brace
082
083 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value createNames()
084 {open braces start code blocks and must be matched with a close brace
085 names=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Authors: Tyler and Jacob");
086 names.setColor(Color.BLACK);
087 names.setScale(.35);
088 names.setLocation(.2,.05);
089 canvas.addSprite(names);
090 }close braces end code blocks and must match an earlier open brace
091
092 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value createTitle()
093 {open braces start code blocks and must be matched with a close brace
094 title=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Interactive Image");
095 title.setColor(Color.RED);
096 title.setScale(.8);
097 title.setLocation(.5,.19);
098 canvas.addSprite(title);
099 }close braces end code blocks and must match an earlier open brace
100
101 //makes a circle and follows a path around my outline
102 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value createBox1()
103 {open braces start code blocks and must be matched with a close brace
104 box1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(3);
105 box1.setScale(.1);
106 box1.setColor(Color.BLACK);
107 canvas.addSprite(box1);
108
109 tracker=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OutlineTracker(outline,.5);
110 box1.setTracker(tracker);
111 box1.setLocation(tracker.getCurrentPoint());
112 tracker.setLooping(truetrue is the boolean value that is the opposite of false);
113 }close braces end code blocks and must match an earlier open brace
114
115 classclass is a group of fields and methods used for making objects Box1 implementsimplements means providing method bodies for the methods declared in the corresponding interface Alarm
116 {open braces start code blocks and must be matched with a close brace
117 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value alarm()
118 {open braces start code blocks and must be matched with a close brace
119 createBox1();
120 }close braces end code blocks and must match an earlier open brace
121 }close braces end code blocks and must match an earlier open brace
122
123 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)
124 {open braces start code blocks and must be matched with a close brace
125 Point2D.Double click=this assignment operator makes the left side equal to the right sidegetPlayer().getMouse().getClickLocation();
126 ifif executes the next statement only if the condition in parenthesis evaluates to true(click!=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)
127 {open braces start code blocks and must be matched with a close brace
128 ifif executes the next statement only if the condition in parenthesis evaluates to true(clickCount==this is the comparison operator which evaluates to true if both sides are the same0)
129 {open braces start code blocks and must be matched with a close brace
130 scheduleRelative(newnew is used to create objects by calling the constructor Box1(), .5);
131 }close braces end code blocks and must match an earlier open brace
132 }close braces end code blocks and must match an earlier open brace
133 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)
134 {open braces start code blocks and must be matched with a close brace
135 ifif executes the next statement only if the condition in parenthesis evaluates to true(clickCount==this is the comparison operator which evaluates to true if both sides are the same0)
136 {open braces start code blocks and must be matched with a close brace
137 canvas.removeSprite(start, names, title);
138 clickCount=this assignment operator makes the left side equal to the right side1;
139 }close braces end code blocks and must match an earlier open brace
140 elseelse is what happens when the if condition is false ifif executes the next statement only if the condition in parenthesis evaluates to true(clickCount==this is the comparison operator which evaluates to true if both sides are the same1)
141 {open braces start code blocks and must be matched with a close brace
142 box1.setScale(random.nextDouble());
143 sound.play();
144 }close braces end code blocks and must match an earlier open brace
145 }close braces end code blocks and must match an earlier open brace
146 ifif executes the next statement only if the condition in parenthesis evaluates to true(clickCount==this is the comparison operator which evaluates to true if both sides are the same1)
147 {open braces start code blocks and must be matched with a close brace
148 ifif executes the next statement only if the condition in parenthesis evaluates to true(getPlayer().getKeyboard().getLastKey()==this is the comparison operator which evaluates to true if both sides are the same'q')
149 {open braces start code blocks and must be matched with a close brace
150 box1.setColor(Color.RED);
151 }close braces end code blocks and must match an earlier open brace
152 ifif executes the next statement only if the condition in parenthesis evaluates to true(getPlayer().getKeyboard().getLastKey()==this is the comparison operator which evaluates to true if both sides are the same'w')
153 {open braces start code blocks and must be matched with a close brace
154 box1.setColor(Color.BLUE);
155 }close braces end code blocks and must match an earlier open brace
156 ifif executes the next statement only if the condition in parenthesis evaluates to true(getPlayer().getKeyboard().getLastKey()==this is the comparison operator which evaluates to true if both sides are the same'e')
157 {open braces start code blocks and must be matched with a close brace
158 box1.setColor(Color.GREEN);
159 }close braces end code blocks and must match an earlier open brace
160 }close braces end code blocks and must match an earlier open brace
161 }close braces end code blocks and must match an earlier open brace
162 }close braces end code blocks and must match an earlier open brace
|