Class republikensoft.Gunfighter
All Packages  Class Hierarchy  This Package  Previous  Next  Index
  Class republikensoft.Gunfighter
java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----java.applet.Applet
                                   |
                                   +----republikensoft.Gunfighter
  -  public class Gunfighter
  -  extends Applet
  -  implements Runnable
This class is the main program that controls the game.
  	To make communication with other classes easier,
  	some methods and variables are made static.
  	This is no limitation since we only have one instance of this class.
	Some important variables are made public just to show up in this page.
   
  -   actor actor
-      actor[0] - The Good (blue) 
 actor[1] - The Bad and Ugly (red)
-   gameState gameState
-      This variable controls the behavior of the game.
  
-   obstacles obstacles
-      This array contains the obstacles for the current playfield.
  
-   scenes scenes
-      Array of arrays containing tripples with object types and coordinates.
  
-   screenHeight screenHeight
-      Playfield height.
  
-   screenWidth screenWidth
-      Playfield width.
  
-   sfx sfx
-      The sound effects.
  
-   textures textures
-      All the obstacle's textures and the bullet texture.
   
  -   Gunfighter() Gunfighter()
-  
   
  -   handleEvent(Event) handleEvent(Event)
-    	Takes care of user input.
  
-   init() init()
-    	Sets up some drawing areas, fonts, colours and builds the
	obstacle polygons.
  
-   paint(Graphics) paint(Graphics)
-    	Draws the offscreen buffer into the screen.
  
-   run() run()
-    	The main loop of the game.
  
-   start() start()
-  	Creates a new game thread.
  
-   stop() stop()
-    	Stops the game and soundplaying.
  
-   update(Graphics) update(Graphics)
-    	Draws into offscreen depending of gameState.
   
 actor
actor
  public static Player actor[]
  -  actor[0] - The Good (blue) 
 actor[1] - The Bad and Ugly (red)
 gameState
gameState
  public static int gameState
  -  This variable controls the behavior of the game.
    The states are: loading, intro, new game, new duel,
    action, player dead, between level and game over.
 obstacles
obstacles
  public static Obstacle obstacles[]
  -  This array contains the obstacles for the current playfield.
 scenes
scenes
  public final short scenes[][]
  -  Array of arrays containing tripples with object types and coordinates.
 screenHeight
screenHeight
  public final static int screenHeight
  -  Playfield height.
    Currently set to 440 pixels.
 screenWidth
screenWidth
  public final static int screenWidth
  -  Playfield width.
    Currently set to 740 pixels.
 sfx
sfx
  public static AudioClip sfx[]
  -  The sound effects.
    
 
    
    | 0 - shoot | 1 - ricochet | 2 - click | 3 - reload |  
    | 4 - scream | 5 - prepare | 6 - intro |  
 
 textures
textures
  public static Image textures[]
  -  All the obstacle's textures and the bullet texture.
    
 
    
    | 0 - blue ammo box | 1 - red ammo box | 2 - big rock left | 3 - small rock right |  
    | 4 - big rock right | 5 - small rock left | 6 - spuce | 7 - triange bush |  
    | 8 - round tree light | 9 - round tree dark | 10 - bullet |  
 
   
 Gunfighter
Gunfighter
  public Gunfighter()
   
 handleEvent
handleEvent
  public boolean handleEvent(Event e)
  -  Takes care of user input.
  
    -  Overrides:
    
-  handleEvent in class Component
  
 
 init
init
  public void init()
  -  Sets up some drawing areas, fonts, colours and builds the
	obstacle polygons.
  
    -  Overrides:
    
-  init in class Applet
  
 
 paint
paint
  public void paint(Graphics g)
  -  Draws the offscreen buffer into the screen.
  
    -  Overrides:
    
-  paint in class Component
  
 
 run
run
  public void run()
  -  The main loop of the game.
	Sleep, update game, repaint and loop.
 start
start
  public void start()
  -  Creates a new game thread.
  
    -  Overrides:
    
-  start in class Applet
  
 
 stop
stop
  public void stop()
  -  Stops the game and soundplaying.
  
    -  Overrides:
    
-  stop in class Applet
  
 
 update
update
  public void update(Graphics g)
  -  Draws into offscreen depending of gameState.
  
    -  Overrides:
    
-  update in class Component
  
 
All Packages  Class Hierarchy  This Package  Previous  Next  Index