|
001 packagepackage is used to name the directory or folder a class is in HemendraPavitra;
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 importimport means to make the classes and/or packages available in this program Beta.OutlineTracker;
008
009 /**
010 * All about my game here.
011 * @authorthis is the Javadoc tag for documenting who created the source code Hpullay
012 */
013 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
014 {open braces start code blocks and must be matched with a close brace
015 privateprivate is used to restrict access to the current class only ImageSprite mike;
016 privateprivate is used to restrict access to the current class only StringSprite title,names;
017 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("Uhoh.wav"));
018 privateprivate is used to restrict access to the current class only OutlineTracker tracker, tracker1;
019 privateprivate is used to restrict access to the current class only Sprite mike2, uglygirl;
020 privateprivate is used to restrict access to the current class only Sprite sprite;
021 privateprivate is used to restrict access to the current class only ProjectileTracker pTracker, pTracker1;
022 privateprivate is used to restrict access to the current class only Sprite outline=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(8);
023 privateprivate is used to restrict access to the current class only Sprite oval;
024 privateprivate is used to restrict access to the current class only ProjectileTracker track;
025
026 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value startGame()
027 {open braces start code blocks and must be matched with a close brace
028
029 makesSprites();
030 addSprites();
031
032 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);
033 ProjectileTracker pTracker=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ProjectileTracker(direction);
034 pTracker.setAngularVelocity(2);
035
036 ProjectileTracker pTracker1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ProjectileTracker(direction);
037 pTracker1.setAngularVelocity(5);
038
039 tracker=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OutlineTracker(sprite, 0.8);
040 tracker.setLooping(truetrue is the boolean value that is the opposite of false);
041 //mike.
042 tracker1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OutlineTracker(sprite, -0.2);
043 tracker1.setLooping(truetrue is the boolean value that is the opposite of false);
044 //ugly girl.
045
046 CompositeTracker composite=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor CompositeTracker();
047 CompositeTracker composite2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor CompositeTracker();
048
049 composite.addTracker(tracker);
050 composite.addTracker(pTracker);
051
052 composite2.addTracker(tracker1);
053 composite2.addTracker(pTracker1);
054
055 mike2.setLocation(tracker.getCurrentPoint());
056 mike2.setTracker(composite);
057
058 uglygirl.setLocation(tracker1.getCurrentPoint());
059 uglygirl.setTracker(composite2);
060
061 setHelpText(
062 "Sad Mike is traveling around<br><br>"+adds two numbers together or concatenates Strings together
063 "the block. Watch.");
064
065 }close braces end code blocks and must match an earlier open brace
066
067 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value makesSprites()
068 {open braces start code blocks and must be matched with a close brace
069 sound.play();
070
071 title=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Sad Mike's Journey's Around the Block!");
072 title.setScale(.9);
073 title.setLocation(.5,.12);
074 title.setColor(Color.RED);
075 //*Adds the title of the game.*/
076
077 mike2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite(Wiki.getMedia("Mike2.jpg"));
078 mike2.setScale(0.1);
079 mike2.setLocation(0.5, 0.5);
080
081 uglygirl=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite(Wiki.getMedia("UglyGirl.jpg"));
082 uglygirl.setScale(0.1);
083 uglygirl.setLocation(0.8, 0.3);
084
085 names=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Hemendra Pullay Pavitra Pullay");
086 names.setScale(.7);
087 names.setLocation(.5,.95);
088 names.setColor(Color.WHITE);
089 //*Adds the authors to the game.*/
090
091 outline.setScale(0.5);
092 outline.setLocation(0.5, 0.5);
093 outline.setColor(Color.GREEN);
094 //*Adds the sprite that will be outlined in the game.*/
095
096 sprite=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(8);
097 sprite.setLocation(0.5, 0.5);
098 sprite.setScale(.5);
099 //shape of object being outlined.
100
101
102 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);
103 oval.setScale(0.15);
104 oval.setLocation(0.2, 0.2);
105 oval.setColor(Color.WHITE);
106 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);
107 track=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ProjectileTracker(direction);
108 track.setAngularVelocity(3.14);
109 oval.setTracker(track);
110
111
112 }close braces end code blocks and must match an earlier open brace
113 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makeBounce()
114 {open braces start code blocks and must be matched with a close brace
115 ifif executes the next statement only if the condition in parenthesis evaluates to true(mike2.intersects(uglygirl))
116 {open braces start code blocks and must be matched with a close brace
117 tracker=this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor OutlineTracker(sprite, -0.8);
118 tracker.setLooping(truetrue is the boolean value that is the opposite of false);
119 //mike.
120 tracker1=this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor OutlineTracker(sprite, -0.2);
121 tracker1.setLooping(truetrue is the boolean value that is the opposite of false);
122 //ugly girl.
123 }close braces end code blocks and must match an earlier open brace
124 }close braces end code blocks and must match an earlier open brace
125
126 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value addSprites()
127 {open braces start code blocks and must be matched with a close brace
128 canvas.addSprite(outline);
129 canvas.addSprite(title,names);
130 canvas.addSprite(mike2);
131 canvas.addSprite(uglygirl);
132 canvas.addSprite(oval);
133 }close braces end code blocks and must match an earlier open brace
134
135 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)
136 {open braces start code blocks and must be matched with a close brace
137 makeBounce();
138
139 }close braces end code blocks and must match an earlier open brace
140 }close braces end code blocks and must match an earlier open brace
|