|
01 package jam;
02
03 import fang.*;
04 import java.awt.*;
05 import java.awt.geom.*;
06
07 /**
08 * All about my game.
09 * @author My Name Here
10 */
11 public class BeautifulPicture extends Game
12 {
13 /**an oval*/
14 private ImageSprite oval;
15
16 /**sets up the game*/
17 public void setup()
18 {
19 makeSprites();
20 addSprites();
21 }
22
23 /**makes the sprites*/
24 private void makeSprites()
25 {
26 oval=new ImageSprite("Untitled.PNG");
27 oval.setSize(0.75);
28 oval.setLocation(0.5, 0.5);
29 }
30
31 /**adds the sprites to the screen*/
32 private void addSprites()
33 {
34 addSprite(oval);
35 }
36
37 /**handle input and game events*/
38 public void advance()
39 {
40 oval.setLocation(getMouse2D());
41 if(getClick2D()!=null)
42 {
43 oval.setSize(randomDouble());
44 }
45 if(getKeyPressed()=='r')
46 {
47 oval.setColor(Palette.getColor("red"));
48 }
49 if(getKeyPressed()=='w')
50 {
51 oval.setColor(Palette.getColor("white"));
52 }
53 }
54 }
|