From ggc
|
001 packagepackage is used to name the directory or folder a class is in KimMooney;
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
008 /**
009 * All about my game here.
010 * @authorthis is the Javadoc tag for documenting who created the source code Kmooney
011 */
012 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 LetsMakeADeal extendsextends means to customize or extend the functionality of a class GameLoop
013 {open braces start code blocks and must be matched with a close brace
014 privateprivate is used to restrict access to the current class only Sprite Instructions;
015 privateprivate is used to restrict access to the current class only Sprite Instructions2;
016 privateprivate is used to restrict access to the current class only Sprite box1;
017 privateprivate is used to restrict access to the current class only Sprite box2;
018 privateprivate is used to restrict access to the current class only intint is the type for whole numbers and it is short for integer winningDoor;
019 privateprivate is used to restrict access to the current class only Sprite box3;
020 privateprivate is used to restrict access to the current class only Sprite box1Label;
021 privateprivate is used to restrict access to the current class only Sprite box2Label;
022 privateprivate is used to restrict access to the current class only Sprite box3Label;
023 privateprivate is used to restrict access to the current class only Sprite RedDot;
024 privateprivate is used to restrict access to the current class only Sprite RedDot2;
025 privateprivate is used to restrict access to the current class only Sprite GreenDot;
026 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("Beep1.wav"));
027
028 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value startGame()
029 {open braces start code blocks and must be matched with a close brace
030 makeSprites();
031 addSprites();
032 toggleAudible();
033 }close braces end code blocks and must match an earlier open brace
034
035 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makeSprites()
036 {open braces start code blocks and must be matched with a close brace
037 Instructions=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("1.)Click on door");
038 Instructions.setScale(0.3);
039 Instructions.setLocation(.2, .2);
040 Instructions.setColor(Color.RED);
041
042 Instructions2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("2.)Click on same or different door");
043 Instructions2.setScale(0.5);
044 Instructions2.setLocation(0.3, 0.3);
045 Instructions2.setColor(Color.RED);
046
047 box1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor RectangleSprite(1,1);
048 box1.setScale(0.25);
049 box1.setLocation(0.5, 0.5);
050
051 box1Label=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("2");
052 box1Label.setScale(0.15);
053 box1Label.setLocation(0.5, 0.5);
054 box1Label.setColor(Color.WHITE);
055
056 RedDot=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite(Wiki.getMedia("Dog.gif"));
057 RedDot.setScale(.1);
058 RedDot.setLocation(0.5, 0.5);
059 RedDot.setColor(Color.RED);
060
061 box2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor RectangleSprite(1, 1);
062 box2.setScale(0.25);
063 box2.setLocation(0.8, 0.5);
064
065 box2Label=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("3");
066 box2Label.setScale(0.15);
067 box2Label.setLocation(0.8, 0.5);
068 box2Label.setColor(Color.WHITE);
069
070 RedDot2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite(Wiki.getMedia("Bomb.gif"));
071 RedDot2.setScale(.1);
072 RedDot2.setLocation(0.8, 0.5);
073 RedDot2.setColor(Color.RED);
074
075 winningDoor=this assignment operator makes the left side equal to the right siderandom.nextInt(3)+adds two numbers together or concatenates Strings together1;
076 box3=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor RectangleSprite(1, 1);
077 box3.setScale(0.25);
078 box3.setLocation(0.2, 0.5);
079
080 box3Label=this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor StringSprite("1");
081 box3Label.setScale(0.15);
082 box3Label.setLocation(0.2, 0.5);
083 box3Label.setColor(Color.WHITE);
084
085 GreenDot=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite(Wiki.getMedia("Treasure.gif"));
086 GreenDot.setScale(.1);
087 GreenDot.setLocation(0.2, 0.5);
088 GreenDot.setColor(Color.GREEN);
089
090 sound.loop();
091 }close braces end code blocks and must match an earlier open brace
092
093 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value addSprites()
094 {open braces start code blocks and must be matched with a close brace
095 canvas.addSprite(Instructions);
096 canvas.addSprite(Instructions2);
097 canvas.addSprite(RedDot);
098 canvas.addSprite(RedDot2);
099 canvas.addSprite(GreenDot);
100 canvas.addSprite(box1);
101 canvas.addSprite(box2);
102 canvas.addSprite(box3);
103 canvas.addSprite(box1Label);
104 canvas.addSprite(box2Label);
105 canvas.addSprite(box3Label);
106
107 }close braces end code blocks and must match an earlier open brace
108
109 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)
110 {open braces start code blocks and must be matched with a close brace
111 Point2D.Double click=this assignment operator makes the left side equal to the right sidegetPlayer().getMouse().getClickLocation();
112 //did they click at all
113 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)
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(box1.intersects(click))
116 {open braces start code blocks and must be matched with a close brace
117 canvas.removeSprite(box1);
118 canvas.removeSprite(box1Label);
119 }close braces end code blocks and must match an earlier open brace
120 ifif executes the next statement only if the condition in parenthesis evaluates to true(box2.intersects(click))
121 {open braces start code blocks and must be matched with a close brace
122 canvas.removeSprite(box2);
123 canvas.removeSprite(box2Label);
124 }close braces end code blocks and must match an earlier open brace
125 ifif executes the next statement only if the condition in parenthesis evaluates to true(box3.intersects(click))
126 {open braces start code blocks and must be matched with a close brace
127 canvas.removeSprite(box3);
128 canvas.removeSprite(box3Label);
129 }close braces end code blocks and must match an earlier open brace
130 ifif executes the next statement only if the condition in parenthesis evaluates to true(box1.intersects(click))
131 {open braces start code blocks and must be matched with a close brace
132 canvas.removeSprite(box2);
133 canvas.removeSprite(box2Label);
134 }close braces end code blocks and must match an earlier open brace
135 ifif executes the next statement only if the condition in parenthesis evaluates to true(box2.intersects(click))
136 {open braces start code blocks and must be matched with a close brace
137 canvas.removeSprite(box1);
138 canvas.removeSprite(box1Label);
139
140 }close braces end code blocks and must match an earlier open brace
141 }close braces end code blocks and must match an earlier open brace
142
143
144 }close braces end code blocks and must match an earlier open brace
145
146 }close braces end code blocks and must match an earlier open brace
|
Compiler Errors:
----------
1. ERROR in KimMooney/LetsMakeADeal.java (at line 56)
RedDot=new ImageSprite(Wiki.getMedia("Dog.gif"));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The constructor ImageSprite(URL) is undefined
----------
2. ERROR in KimMooney/LetsMakeADeal.java (at line 70)
RedDot2=new ImageSprite(Wiki.getMedia("Bomb.gif"));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The constructor ImageSprite(URL) is undefined
----------
3 problems (3 errors)
Download/View KimMooney/LetsMakeADeal.java