arcade/ClassLauncher

From ggc

Jump to: navigation, search

01 package arcade;
02 import java.awt.Color;
03 import java.awt.event.KeyEvent;
04 
05 import fang.*;
06 
07 /**
08  * This class simply launches the ArcadeGame.
09  @author Jam Jenkins
10  *   
11  */
12 public class ClassLauncher extends GameLoop
13 {
14   private ArcadeGame topLevel;
15 
16 
17   /**
18    * sets the level at which to start
19    */
20   public void startGame()
21   {
22     topLevel=new ClassArcade();
23     topLevel.setName("Wackadot");
24     setNextLevel(topLevel);
25 
26 
27 
28     StringSprite toFinish=new StringSprite("Press ESC\nto end game");
29     toFinish.rightJustify();
30     toFinish.bottomJustify();
31     toFinish.setScale(0.2);
32     toFinish.setLocation(0.980.98);
33     toFinish.setColor(new Color(255255064));
34     canvas.addSprite(toFinish);
35     topLevel.persist(toFinish);
36   }
37 
38   /**
39    * enables the Escape key to finish the level at any time
40    */
41   public void advanceFrame(double timeElapsed)
42   {
43     if(getPlayer().getKeyboard().getLastKey()==KeyEvent.VK_ESCAPE)
44       finishLevel();
45     if(getLevelNumber()==0)
46       setNextLevel(topLevel);
47   }
48 
49   /**
50    * runs the game as an application
51    @param args not used
52    */
53   public static void main(String[] args)
54   {
55     new ArcadeLauncher().runAsApplication();
56   }
57 }


Download/View arcade/ClassLauncher.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