Merima/arcade/ArcadeGamesLauncher

From ggc

Jump to: navigation, search

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


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