intro/DelayedInteraction

From ggc

Jump to: navigation, search

01 package intro;
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 DelayedInteraction extends Game
12 {
13   /**an oval*/
14   private Sprite 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 OvalSprite(21);
27     oval.setSize(0.75);
28     oval.setLocation(0.50.5);
29   }
30 
31   /**adds the sprites to the screen*/
32   private void addSprites()
33   {
34     addSprite(oval);
35   }
36 
37   class DelayedResponse extends TimedAction
38   {
39     public void act()
40     {
41       oval.setColor(getColor("white"));
42     }
43   }
44 
45   /**handle input and game events*/
46   public void advance()
47   {
48     if(getClick2D()!=null)
49     {
50       schedule(new DelayedResponse()2.5);
51     }
52   }
53 }


Download/View intro/DelayedInteraction.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