From ggc
|
01 importimport means to make the classes and/or packages available in this program fang.*;
02 importimport means to make the classes and/or packages available in this program java.awt.*;
03
04 /**
05 * All about my game here.
06 * @authorthis is the Javadoc tag for documenting who created the source code Jam Jenkins
07 */
08 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 ImageSprteExample extendsextends means to customize or extend the functionality of a class GameLoop
09 {open braces start code blocks and must be matched with a close brace
10 /**an oval*/
11 privateprivate is used to restrict access to the current class only Sprite oval;
12
13 /**sets up the game*/
14 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value startGame()
15 {open braces start code blocks and must be matched with a close brace
16 makeSprites();
17 addSprites();
18 }close braces end code blocks and must match an earlier open brace
19
20 /**makes the sprites*/
21 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value makeSprites()
22 {open braces start code blocks and must be matched with a close brace
23 oval=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite(Wiki.getMedia("Jam.jpg"));
24 oval.setScale(0.75);
25 oval.setLocation(0.5, 0.5);
26 }close braces end code blocks and must match an earlier open brace
27
28 /**adds the sprites to the screen*/
29 privateprivate is used to restrict access to the current class only voidvoid means the method does not return a value addSprites()
30 {open braces start code blocks and must be matched with a close brace
31 canvas.addSprite(oval);
32 }close braces end code blocks and must match an earlier open brace
33
34 /**handle input and game events*/
35 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)
36 {open braces start code blocks and must be matched with a close brace
37 oval.setLocation(getPlayer().getMouse().getLocation());
38 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)
39 {open braces start code blocks and must be matched with a close brace
40 oval.setScale(random.nextDouble());
41 }close braces end code blocks and must match an earlier open brace
42 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')
43 {open braces start code blocks and must be matched with a close brace
44 oval.setColor(Color.RED);
45 }close braces end code blocks and must match an earlier open brace
46 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')
47 {open braces start code blocks and must be matched with a close brace
48 oval.setColor(Color.WHITE);
49 }close braces end code blocks and must match an earlier open brace
50 }close braces end code blocks and must match an earlier open brace
51 }close braces end code blocks and must match an earlier open brace
|
Compiler Errors:
----------
1. ERROR in ImageSprteExample.java (at line 23)
oval=new ImageSprite(Wiki.getMedia("Jam.jpg"));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The constructor ImageSprite(URL) is undefined
----------
1 problem (1 error)
Download/View ImageSprteExample.java