|
01 package Tutorial2.Sound;
02
03 import wiki.Wiki;
04 import fang.*;
05 import java.awt.*;
06 import java.awt.geom.*;
07
08 /**
09 * All about my game here.
10 * @author Jam Jenkins
11 */
12 public class Example extends Game
13 {
14 private Sound sound=new Sound("Ding.wav");
15
16 public void setup()
17 {
18 StringSprite instructions=new StringSprite("Click here");
19 instructions.setSize(0.9);
20 instructions.setLocation(0.5, 0.5);
21 addSprite(instructions);
22 startGameImmediately();
23 playSoundImmediately();
24
25 String helpText="Click to play a ding.";
26 setHelpText(helpText);
27 }
28
29 public void advance()
30 {
31 if(getClick2D()!=null)
32 {
33 sound.play(getMouseX());
34 }
35 }
36 }
|