scg/ch06/CountdownTimerTest

From FANG

Jump to: navigation, search

01 package scg.ch06;
02 
03 import fang2.core.Game;
04 
05 /**
06  * Demonstration program showing how to use a CountdownTimer object.
07  */
08 public class CountdownTimerTest
09   extends Game {
10   /** the countdown timer */
11   CountdownTimer countdown;
12 
13   /**
14    * Setup the countdown timer with 30 seconds on its face and place it
15    * in the middle of the screen.
16    */
17   @Override
18   public void setup() {
19     countdown = new CountdownTimer();
20     countdown.setScale(0.5);
21     countdown.setLocation(0.50.5);
22     addSprite(countdown);
23 
24     countdown.setTimer(30.0);
25     countdown.startTimer();// will start as soon as game starts
26   }
27 
28   /**
29    * Advance the game one frame. All the work here is pushed down into
30    * the countdown timer.
31    */
32   @Override
33   public void advance(double deltaT{
34     countdown.advance(deltaT);
35   }
36 }
37 
38 //Uploaded on Mon Mar 29 21:38:59 EDT 2010


Download/View scg/ch06/CountdownTimerTest.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