Tutorial2/Sound/Example

From FANG

Jump to: navigation, search

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.50.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 }


Download/View Tutorial2/Sound/Example.java




Views
Personal tools
Add to 
del.icio.usAdd to 
diggAdd to 
FacebookAdd to 
favoritesAdd to 
GoogleAdd to 
MySpaceAdd to 
PrintAdd to 
SlashdotAdd to 
StumbleUponAdd to 
Twitter

Games
Games