Class Player

java.lang.Object
  |
  +--Player

public class Player
extends java.lang.Object


Field Summary
protected  Canvas3DEx m_cCanvas3D
          Player window canvas
protected  PlayerKeyNavigator m_cKeyNavigator
           
protected  PlayerWall m_cPlayerWall
           
protected  javax.vecmath.Point3f m_cStartPoint
          Start position in the playfield
protected  javax.media.j3d.View m_cView
          Player view
protected  javax.media.j3d.BranchGroup m_cViewBrGroup
          View branch group
protected  javax.media.j3d.BranchGroup m_cWallBrGroup
          View branch group
protected  javax.vecmath.Color3f m_cWallColor
          Wall color
protected  javax.media.j3d.TransformGroup m_cWallTrGroup
          Wall transform group
 
Constructor Summary
Player(javax.vecmath.Point3f cStartPoint)
          Creates all elements needed for a new player: - Player view - Key and collision handler
 
Method Summary
protected  void constructPlayerBranch()
          Creates the player branch group.
 void endGame()
          Command for stopping the game.
 Canvas3DEx getCanvas()
          Returns the canvas of the player view window.
 javax.media.j3d.View getView()
          Returns the player view.
 javax.media.j3d.BranchGroup getViewBrGroup()
          Returns the view branch group.
 javax.media.j3d.BranchGroup getWallBrGroup()
          Returns the wall branch group.
 void setForwardKey(int iKey)
          Sets the forward motion key.
 void setLeftKey(int iKey)
          Sets the key for a left turn.
 void setRightKey(int iKey)
          Sets the key for a right turn.
 void setWallColor(javax.vecmath.Color3f cCol)
          Sets the wall color of the player's wall.
 void startGame()
          Command for starting the game.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_cCanvas3D

protected Canvas3DEx m_cCanvas3D
Player window canvas

m_cView

protected javax.media.j3d.View m_cView
Player view

m_cKeyNavigator

protected PlayerKeyNavigator m_cKeyNavigator

m_cPlayerWall

protected PlayerWall m_cPlayerWall

m_cViewBrGroup

protected javax.media.j3d.BranchGroup m_cViewBrGroup
View branch group

m_cWallBrGroup

protected javax.media.j3d.BranchGroup m_cWallBrGroup
View branch group

m_cWallTrGroup

protected javax.media.j3d.TransformGroup m_cWallTrGroup
Wall transform group

m_cStartPoint

protected javax.vecmath.Point3f m_cStartPoint
Start position in the playfield

m_cWallColor

protected javax.vecmath.Color3f m_cWallColor
Wall color
Constructor Detail

Player

public Player(javax.vecmath.Point3f cStartPoint)
Creates all elements needed for a new player: - Player view - Key and collision handler
Parameters:
cStartPoint - Defines the start coordinates of the player in the play field
Method Detail

startGame

public void startGame()
Command for starting the game. Activates the key handler and starts the constant forward movement.

endGame

public void endGame()
Command for stopping the game. De-activates the key handler.

setWallColor

public void setWallColor(javax.vecmath.Color3f cCol)
Sets the wall color of the player's wall.
Parameters:
cCol - The wall color.

setForwardKey

public void setForwardKey(int iKey)
Sets the forward motion key.
Parameters:
iKey - Associeted key

setLeftKey

public void setLeftKey(int iKey)
Sets the key for a left turn.
Parameters:
iKey - Associeted key

setRightKey

public void setRightKey(int iKey)
Sets the key for a right turn.
Parameters:
iKey - Associeted key

getWallBrGroup

public final javax.media.j3d.BranchGroup getWallBrGroup()
Returns the wall branch group.
Returns:
The BranchGroup of the walls

getViewBrGroup

public final javax.media.j3d.BranchGroup getViewBrGroup()
Returns the view branch group.
Returns:
The BranchGroup of the player view

getCanvas

public final Canvas3DEx getCanvas()
Returns the canvas of the player view window.
Returns:
The Canvas3D of the player view window.

getView

public final javax.media.j3d.View getView()
Returns the player view.
Returns:
The View of the player.

constructPlayerBranch

protected void constructPlayerBranch()
Creates the player branch group. The wall branch group will be created and initialized with it's initial position.