Class CHuman

java.lang.Object
  |
  +--CHuman
Direct Known Subclasses:
CEnemy, CMan

public class CHuman
extends java.lang.Object

CHuman class, abstract human implementation

Version:
1.0
Author:
Created and maintained by Roman Podobedov

Field Summary
 int cell_height
           
 int cell_width
           
protected  int direction
           
 boolean in_pit
           
protected  boolean in_the_fly
           
 boolean is_dead
           
protected  boolean m_only_one_cell
           
protected  boolean m_only_one_cell_leftright
           
protected  boolean m_only_one_cell_updown
           
protected  int m_pos_x
           
 int m_pos_x_cell
           
protected  int m_pos_y
           
 int m_pos_y_cell
           
protected  int man_type
           
protected  int max_sprites
           
protected  int number_of_boxes
           
 int number_of_boxes_score
           
 boolean onRope
           
protected  int sprite_num
           
 
Constructor Summary
CHuman()
          Constructor
 
Method Summary
 void CheckBounds(CLevel level)
          Check current human position in level
 boolean DoCalculations(CLevel level)
          Do some calculations for human
 int GetDirection()
          Get direction of human
 int GetPosX()
          Get current X position
 int GetPosY()
          Get current Y position
 int GetSpriteNum()
          Get current sprite number
 void Hit(CLevel level)
          Do one hit
protected  void IncreaseSprite()
          Increase current sprite of human
 void RecalculateData()
          Recalculates all positioning data in class (must be called, when any change is maded)
 void SetPosition(int x, int y)
          Set human position (pixels)
 boolean StepDown(CLevel level)
          Do one step down
 boolean StepLeft(CLevel level)
          Do one step left
 boolean StepRight(CLevel level)
          Do one step right
 boolean StepUp(CLevel level)
          Do one step up
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

max_sprites

protected int max_sprites

m_pos_x

protected int m_pos_x

m_pos_y

protected int m_pos_y

m_pos_x_cell

public int m_pos_x_cell

m_pos_y_cell

public int m_pos_y_cell

m_only_one_cell

protected boolean m_only_one_cell

m_only_one_cell_updown

protected boolean m_only_one_cell_updown

m_only_one_cell_leftright

protected boolean m_only_one_cell_leftright

direction

protected int direction

onRope

public boolean onRope

sprite_num

protected int sprite_num

cell_width

public int cell_width

cell_height

public int cell_height

number_of_boxes

protected int number_of_boxes

number_of_boxes_score

public int number_of_boxes_score

in_the_fly

protected boolean in_the_fly

man_type

protected int man_type

is_dead

public boolean is_dead

in_pit

public boolean in_pit
Constructor Detail

CHuman

public CHuman()
Constructor
Method Detail

SetPosition

public void SetPosition(int x,
                        int y)
Set human position (pixels)
Parameters:
x - X Position on human (in pixels)
y - Y Position on human (in pixels)

GetDirection

public int GetDirection()
Get direction of human
Returns:
Current direction of human

RecalculateData

public void RecalculateData()
Recalculates all positioning data in class (must be called, when any change is maded)

GetSpriteNum

public int GetSpriteNum()
Get current sprite number
Returns:
Sprite number

GetPosX

public int GetPosX()
Get current X position
Returns:
X position (in pixels)

GetPosY

public int GetPosY()
Get current Y position
Returns:
Y position (in pixels)

StepRight

public boolean StepRight(CLevel level)
Do one step right
Parameters:
level - pointer to level

StepLeft

public boolean StepLeft(CLevel level)
Do one step left
Parameters:
level - pointer to level

StepUp

public boolean StepUp(CLevel level)
Do one step up
Parameters:
level - pointer to level

StepDown

public boolean StepDown(CLevel level)
Do one step down
Parameters:
level - pointer to level

Hit

public void Hit(CLevel level)
Do one hit
Parameters:
level - pointer to level

IncreaseSprite

protected void IncreaseSprite()
Increase current sprite of human

CheckBounds

public void CheckBounds(CLevel level)
Check current human position in level
Parameters:
level - pointer to level

DoCalculations

public boolean DoCalculations(CLevel level)
Do some calculations for human
Parameters:
level - pointer to level
Returns:
True - if keyboard must be blocked (human on the fly), False - otherwise