From ggc
|
001 packagepackage is used to name the directory or folder a class is in Merima;
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 Merima Omanovic
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 deal 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 box1;
015 privateprivate is used to restrict access to the current class only Sprite box2;
016 privateprivate is used to restrict access to the current class only Sprite box3;
017 privateprivate is used to restrict access to the current class only Sprite box1Label;
018 privateprivate is used to restrict access to the current class only Sprite box2Label;
019 privateprivate is used to restrict access to the current class only Sprite box3Label;
020 privateprivate is used to restrict access to the current class only Sprite RedDot;
021 privateprivate is used to restrict access to the current class only Sprite RedDot2;
022 privateprivate is used to restrict access to the current class only Sprite GreenDot;
023 privateprivate is used to restrict access to the current class only Sprite Instructions;
024 privateprivate is used to restrict access to the current class only Sprite Instructions2;
025 privateprivate is used to restrict access to the current class only Sprite Instructions3;
026 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;
027 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"));
028
029
030
031
032
033 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value startGame()
034 {open braces start code blocks and must be matched with a close brace
035 makeSprites();
036 addSprites();
037 toggleAudible();
038 }close braces end code blocks and must match an earlier open brace
039
040 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makeSprites()
041 {open braces start code blocks and must be matched with a close brace
042
043 Instructions=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("1. Pick a door!");
044 Instructions.setScale(0.5);
045 Instructions.setLocation(.5, .3);
046 Instructions.setColor(Color.PINK);
047
048 Instructions2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("2. Pick another door!");
049 Instructions2.setScale(0.7);
050 Instructions2.setLocation(0.5, 0.7);
051 Instructions2.setColor(Color.PINK);
052
053 Instructions3=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("3. Goodluck!");
054 Instructions3.setScale(0.6);
055 Instructions3.setLocation(0.5, 0.8);
056 Instructions3.setColor(Color.RED);
057
058 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);
059 box1.setScale(0.25);
060 box1.setLocation(0.5, 0.5);
061
062 box1Label=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("2");
063 box1Label.setScale(0.15);
064 box1Label.setLocation(0.5, 0.5);
065 box1Label.setColor(Color.WHITE);
066
067
068 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("After.gif"));
069 RedDot.setScale(.1);
070 RedDot.setLocation(0.5, 0.5);
071 RedDot.setColor(Color.RED);
072
073
074 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);
075 box2.setScale(0.25);
076 box2.setLocation(0.8, 0.5);
077
078 box2Label=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("3");
079 box2Label.setScale(0.15);
080 box2Label.setLocation(0.8,0.5);
081 box2Label.setColor(Color.WHITE);
082
083 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("After.gif"));
084 RedDot2.setScale(.1);
085 RedDot2.setLocation(0.8, 0.5);
086 RedDot2.setColor(Color.RED);
087
088 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);
089 box3.setScale(0.25);
090 box3.setLocation(0.2, 0.5);
091
092 box3Label=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("1");
093 box3Label.setScale(0.15);
094 box3Label.setLocation(0.2,0.5);
095 box3Label.setColor(Color.WHITE);
096
097 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("Coin1.gif"));
098 GreenDot.setScale(.1);
099 GreenDot.setLocation(0.2, 0.5);
100 GreenDot.setColor(Color.GREEN);
101 }close braces end code blocks and must match an earlier open brace
102
103 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value addSprites()
104 {open braces start code blocks and must be matched with a close brace
105 canvas.addSprite(Instructions);
106 canvas.addSprite(Instructions2);
107 canvas.addSprite(Instructions3);
108 canvas.addSprite(RedDot);
109 canvas.addSprite(RedDot2);
110 canvas.addSprite(GreenDot);
111 canvas.addSprite(box1);
112 canvas.addSprite(box2);
113 canvas.addSprite(box3);
114 canvas.addSprite(box1Label);
115 canvas.addSprite(box2Label);
116 canvas.addSprite(box3Label);
117
118
119
120
121
122 }close braces end code blocks and must match an earlier open brace
123
124 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)
125 {open braces start code blocks and must be matched with a close brace
126 Point2D.Double click=this assignment operator makes the left side equal to the right sidegetPlayer().getMouse().getClickLocation();
127 //did they click at all
128 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)
129 {open braces start code blocks and must be matched with a close brace
130 ifif executes the next statement only if the condition in parenthesis evaluates to true(box3.intersects(click))
131 {open braces start code blocks and must be matched with a close brace
132 canvas.removeSprite(box1);
133 canvas.removeSprite(box1Label);
134 }close braces end code blocks and must match an earlier open brace
135
136 ifif executes the next statement only if the condition in parenthesis evaluates to true(box1.intersects(click))
137 {open braces start code blocks and must be matched with a close brace
138 canvas.removeSprite(box3);
139 canvas.removeSprite(box3Label);
140
141 }close braces end code blocks and must match an earlier open brace
142 ifif executes the next statement only if the condition in parenthesis evaluates to true(box2.intersects(click))
143
144 {open braces start code blocks and must be matched with a close brace
145 intint is the type for whole numbers and it is short for integer q=this assignment operator makes the left side equal to the right siderandom.nextInt(2);
146 ifif executes the next statement only if the condition in parenthesis evaluates to true(q==this is the comparison operator which evaluates to true if both sides are the same0)
147 {open braces start code blocks and must be matched with a close brace
148 canvas.removeSprite(box3);
149 canvas.removeSprite(box3Label);
150 }close braces end code blocks and must match an earlier open brace
151 elseelse is what happens when the if condition is false ifif executes the next statement only if the condition in parenthesis evaluates to true(q==this is the comparison operator which evaluates to true if both sides are the same1)
152 {open braces start code blocks and must be matched with a close brace
153 canvas.removeSprite(box1);
154 canvas.removeSprite(box1Label);
155 }close braces end code blocks and must match an earlier open brace
156 }close braces end code blocks and must match an earlier open brace
157 }close braces end code blocks and must match an earlier open brace
158 }close braces end code blocks and must match an earlier open brace
159
160
161 }close braces end code blocks and must match an earlier open brace
|
Compiler Errors:
----------
1. ERROR in Merima/deal.java (at line 68)
RedDot=new ImageSprite(Wiki.getMedia("After.gif"));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The constructor ImageSprite(URL) is undefined
----------
2. ERROR in Merima/deal.java (at line 83)
RedDot2=new ImageSprite(Wiki.getMedia("After.gif"));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The constructor ImageSprite(URL) is undefined
----------
3 problems (3 errors)
Download/View Merima/deal.java