From ggc
|
001 packagepackage is used to name the directory or folder a class is in RobertKing.interactiveart;
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 * @authornull Rking
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 Interactiveart 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 /**an oval*/
015 privateprivate is used to restrict access to the current class only Sprite skull;
016 privateprivate is used to restrict access to the current class only Sprite oval;
017 privateprivate is used to restrict access to the current class only Sprite sign;
018 privateprivate is used to restrict access to the current class only Sprite sign2;
019 privateprivate is used to restrict access to the current class only Sprite nose;
020 privateprivate is used to restrict access to the current class only Sprite mouth;
021 privateprivate is used to restrict access to the current class only ProjectileTracker track;
022 privateprivate is used to restrict access to the current class only ProjectileTracker track2;
023
024 /**sets up the game*/
025 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value startGame()
026 {open braces start code blocks and must be matched with a close brace
027 makeSprites();
028 addSprites();
029 }close braces end code blocks and must match an earlier open brace
030
031 /**makes the sprites*/
032 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makeSprites()
033 {open braces start code blocks and must be matched with a close brace
034 skull=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite(Wiki.getMedia("skull.jpg"));
035 skull.setScale(1.5);
036 skull.setLocation(0.5, 0.5);
037
038 oval=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite(1, 1);
039 oval.setScale(1.1);
040 oval.setLocation(0.5, 0.5);
041 oval.setColor(Color.BLACK);
042
043 sign=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite(Wiki.getMedia("eye.jpg"));
044 sign.setScale(0.2);
045 sign.setLocation(0.3, 0.35);
046 sign.setColor(Color.BLACK);
047 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);
048 track=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ProjectileTracker(direction);
049 track.setAngularVelocity(3.14);
050 sign.setTracker(track);
051
052 sign2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite(Wiki.getMedia("eye.jpg"));
053 sign2.setScale(0.2);
054 sign2.setLocation(0.75, 0.35);
055 sign2.setColor(Color.BLACK);
056 Point2D.Double dir=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);
057 track2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ProjectileTracker(dir);
058 track2.setAngularVelocity(-3.14);
059 sign2.setTracker(track2);
060
061 nose=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite(Wiki.getMedia("yoga.gif"));
062 nose.setScale(0.15);
063 nose.setLocation(0.5, 0.5);
064
065 mouth=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite(Wiki.getMedia("mouth.jpg"));
066 mouth.setScale(0.3);
067 mouth.setLocation(0.5, 0.8);
068 }close braces end code blocks and must match an earlier open brace
069
070 /**adds the sprites to the screen*/
071 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value addSprites()
072 {open braces start code blocks and must be matched with a close brace
073 canvas.addSprite(skull);
074 canvas.addSprite(sign);
075 canvas.addSprite(sign2);
076 canvas.addSprite(nose);
077 canvas.addSprite(mouth);
078 canvas.addSprite(oval);
079 }close braces end code blocks and must match an earlier open brace
080
081 /**handle input and game events*/
082 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)
083 {open braces start code blocks and must be matched with a close brace
084 oval.setLocation(getPlayer().getMouse().getLocation());
085 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)
086 {open braces start code blocks and must be matched with a close brace
087 oval.setScale(random.nextDouble());
088 }close braces end code blocks and must match an earlier open brace
089 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'r')
090 {open braces start code blocks and must be matched with a close brace
091 oval.setColor(Color.RED);
092 }close braces end code blocks and must match an earlier open brace
093 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')
094 {open braces start code blocks and must be matched with a close brace
095 oval.setColor(Color.WHITE);
096 }close braces end code blocks and must match an earlier open brace
097 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'b')
098 {open braces start code blocks and must be matched with a close brace
099 oval.setColor(Color.BLUE);
100 }close braces end code blocks and must match an earlier open brace
101 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'g')
102 {open braces start code blocks and must be matched with a close brace
103 oval.setColor(Color.GREEN);
104 }close braces end code blocks and must match an earlier open brace
105 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'y')
106 {open braces start code blocks and must be matched with a close brace
107 oval.setColor(Color.YELLOW);
108 }close braces end code blocks and must match an earlier open brace
109 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'o')
110 {open braces start code blocks and must be matched with a close brace
111 oval.setColor(Color.ORANGE);
112 }close braces end code blocks and must match an earlier open brace
113 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'k')
114 {open braces start code blocks and must be matched with a close brace
115 oval.setColor(Color.BLACK);
116 }close braces end code blocks and must match an earlier open brace
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
|
Compiler Errors:
----------
1. ERROR in RobertKing/interactiveart/Interactiveart.java (at line 34)
skull=new ImageSprite(Wiki.getMedia("skull.jpg"));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The constructor ImageSprite(URL) is undefined
----------
2. ERROR in RobertKing/interactiveart/Interactiveart.java (at line 43)
sign=new ImageSprite(Wiki.getMedia("eye.jpg"));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The constructor ImageSprite(URL) is undefined
----------
5 problems (5 errors)
Download/View RobertKing/interactiveart/Interactiveart.java