Class republikensoft.Player
All Packages  Class Hierarchy  This Package  Previous  Next  Index
  Class republikensoft.Player
java.lang.Object
   |
   +----republikensoft.Moving
           |
           +----republikensoft.Player
  -  public class Player
  -  extends Moving
This class controls the players.
   
  -   magSize magSize
-      How many bullets each player has.
  
-   otherPlayer otherPlayer
-  	Used to be able to give the other player points
	when hit by a bullet and to find out which player died.
   
  -   Player(Image[], int[], boolean) Player(Image[], int[], boolean)
-  
   
  -   die() die()
-    	This method is called when the player been hit by a bullet.
  
-   draw(Graphics) draw(Graphics)
-    	Draws the player.
  
-   drawBullets(Graphics) drawBullets(Graphics)
-    	Draws the players moving bullets.
  
-   getAmmo() getAmmo()
-  
  
-   getHit() getHit()
-  
  
-   shoot() shoot()
-  	Fire the gun.
  
-   update() update()
-  	Updates the player and his bullets.
  
-   userInput(int, boolean) userInput(int, boolean)
-  	Acts on user input if the player doesn't collide with something.
   
 magSize
magSize
  public final static int magSize
  -  How many bullets each player has.
    Currently set to 6, and will always be.
 otherPlayer
otherPlayer
  public int otherPlayer
  -  Used to be able to give the other player points
	when hit by a bullet and to find out which player died.
   
 Player
Player
  public Player(Image f[],
                int props[],
                boolean fr)
  
    -  Parameters:
    
-  f - Player frames.
    -  props - Contains a lot of different values that initialises the player.
	See the Player.java and
	Gunfighter.java for more details.
    -  fr - Determines if the player starts facing right or not.
	Also used to determine which player the player is.
  
   
 die
die
  public void die()
  -  This method is called when the player been hit by a bullet.
	Makes the player scream. Updates the score too.
 draw
draw
  public void draw(Graphics g)
  -  Draws the player.
	Uncomment the commented lines if you would like to see how
	the walk and hit rectangles work.
  
    -  Overrides:
    
-  draw in class Moving
  
 
 drawBullets
drawBullets
  public void drawBullets(Graphics g)
  -  Draws the players moving bullets.
 getAmmo
getAmmo
  public int getAmmo()
  
    -  Returns:
    
-  How many bullets the player has left.
    
-  See Also:
    
-  drawStatus
  
 getHit
getHit
  public Rectangle getHit()
  
    -  Returns:
    
-  The rectangle where it's fatal to get a bullet.
  
 shoot
shoot
  public void shoot()
  -  Fire the gun.
	But only if we have ammo and we're able.
 update
update
  public void update()
  -  Updates the player and his bullets.
  
    -  Overrides:
    
-  update in class Moving
  
 
 userInput
userInput
  public void userInput(int key,
                        boolean key_pressed)
  -  Acts on user input if the player doesn't collide with something.
All Packages  Class Hierarchy  This Package  Previous  Next  Index