vooga.games.tron.players
Class TronPlayer

java.lang.Object
  extended by Sprite
      extended by vooga.games.tron.players.TronPlayer

public class TronPlayer
extends Sprite


Field Summary
 boolean[][] blocks
           
 int score
           
 
Constructor Summary
TronPlayer(java.awt.image.BufferedImage image, double initialColPosition, double initialRowPosition, GridSpace gridSpace, int playerImageWidth, java.lang.String initialDirection)
          constructor
 
Method Summary
 void fillBlock(double row, double col)
          mark the block if it is filled by items in the game
 java.lang.String getDirection()
          get the direction the player is heading
 int getImageWidth()
          get the width of the image
 double getPlayerColumn()
          get the column position for the player
 double getPlayerRow()
          get the row position of the player
 double getPlayerXPosition()
          get the X-coordinate position for the player
 double getPlayerYPosition()
          get the Y-coordinate position of the player
 boolean playerInbound()
          check to see if players are in bound
 double playerXDirectionMove()
          routinely update the X-coordinate for the player (keep going in the same X-direction)
 double playerYDirectionMove()
          routinely update the Y-coordinate for the player (keep going in the same Y-direction)
 void resetPosition()
           
 void setDirection(java.lang.String direction)
          set the direction the player is heading
 void setPlayerColumn(int amount)
           
 void setPlayerRow(int amount)
           
 void setPlayerRowandCol(double currentRow, double currentColumn)
          set the row and column position for the player
 void setSpeedUp(int rate)
          speed up the speed
 double updatePlayerXPosition(java.lang.String playerDirection)
          update the X-coordinate position of the player
 double updatePlayerYPosition(java.lang.String playerDirection)
          update the Y-coordinate position for the player
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

blocks

public boolean[][] blocks

score

public int score
Constructor Detail

TronPlayer

public TronPlayer(java.awt.image.BufferedImage image,
                  double initialColPosition,
                  double initialRowPosition,
                  GridSpace gridSpace,
                  int playerImageWidth,
                  java.lang.String initialDirection)
constructor

Parameters:
image -
initialColPosition -
initialRowPosition -
gridSpace -
playerImageWidth -
initialDirection -
Method Detail

resetPosition

public void resetPosition()

fillBlock

public void fillBlock(double row,
                      double col)
mark the block if it is filled by items in the game

Parameters:
row -
col -

getImageWidth

public int getImageWidth()
get the width of the image

Returns:

setSpeedUp

public void setSpeedUp(int rate)
speed up the speed

Parameters:
rate -

setDirection

public void setDirection(java.lang.String direction)
set the direction the player is heading

Parameters:
direction -

getDirection

public java.lang.String getDirection()
get the direction the player is heading

Returns:

setPlayerRowandCol

public void setPlayerRowandCol(double currentRow,
                               double currentColumn)
set the row and column position for the player

Parameters:
currentRow -
currentColumn -

getPlayerRow

public double getPlayerRow()
get the row position of the player

Returns:

getPlayerYPosition

public double getPlayerYPosition()
get the Y-coordinate position of the player

Returns:

getPlayerColumn

public double getPlayerColumn()
get the column position for the player

Returns:

getPlayerXPosition

public double getPlayerXPosition()
get the X-coordinate position for the player

Returns:

setPlayerColumn

public void setPlayerColumn(int amount)

setPlayerRow

public void setPlayerRow(int amount)

playerXDirectionMove

public double playerXDirectionMove()
routinely update the X-coordinate for the player (keep going in the same X-direction)

Returns:

playerYDirectionMove

public double playerYDirectionMove()
routinely update the Y-coordinate for the player (keep going in the same Y-direction)

Returns:

updatePlayerXPosition

public double updatePlayerXPosition(java.lang.String playerDirection)
update the X-coordinate position of the player

Parameters:
playerDirection -
Returns:

updatePlayerYPosition

public double updatePlayerYPosition(java.lang.String playerDirection)
update the Y-coordinate position for the player

Parameters:
playerDirection -
Returns:

playerInbound

public boolean playerInbound()
check to see if players are in bound

Returns:
true if players are still in bound