Tkirby/TravisKirbyArcadeLauncher

From ggc

Jump to: navigation, search

01 package Tkirby;
02 import java.awt.Color;
03 import java.awt.event.KeyEvent;
04 
05 import fang.*;
06 import arcade.*;
07 /**
08  * This class launches Tkirby/TravisKirbyArcade.
09  * Revised: Travis Kirby     
10  @author Jam Jenkins   
11  */
12 public class TravisKirbyArcadeLauncher extends GameLoop
13 {
14   private ArcadeGame topLevel;
15   private Sprite title;
16 
17   /**
18    * sets the level at which to start
19    */
20   public void startGame()
21   {
22     toggleAudible();
23 
24     topLevel=new TravisKirbyArcade();
25     topLevel.setName("Travis Kirby's Arcade");
26     setNextLevel(topLevel);
27 
28 
29     title=new StringSprite("Click A Title To Play");
30     title.setLocation(0.50.5);
31     title.setScale(0.5);
32     title.setColor(Color.RED);
33     canvas.addSprite(title);
34 
35     StringSprite toFinish=new StringSprite("Press ESC to end game");
36     toFinish.rightJustify();
37     toFinish.bottomJustify();
38     toFinish.setScale(0.3);
39     toFinish.setLocation(0.650.98);
40     toFinish.setColor(Color.RED);
41     canvas.addSprite(toFinish);
42     topLevel.persist(toFinish);
43   }
44 
45   /**
46    * enables the Escape key to finish the level at any time
47    */
48   public void advanceFrame(double timeElapsed)
49   {
50     if(getPlayer().getKeyboard().getLastKey()==KeyEvent.VK_ESCAPE)
51       finishLevel();
52     if(getLevelNumber()==0)
53       setNextLevel(topLevel);
54   }
55 
56   /**
57    * runs the game as an application
58    @param args not used
59    */
60   public static void main(String[] args)
61   {
62     new ArcadeLauncher().runAsApplication();
63   }
64 }


Download/View Tkirby/TravisKirbyArcadeLauncher.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