Class CLevel

java.lang.Object
  |
  +--CLevel

public class CLevel
extends java.lang.Object


Field Summary
 int cell_height
           
 int cell_width
           
 int[][] enemy_coords
           
protected  int gold_box
           
protected  byte[][] level_data
           
 byte level_height
           
 byte level_width
           
protected  int man_x
           
protected  int man_y
           
 boolean on_finishing_stage
           
 int total_enemy
           
 
Constructor Summary
CLevel()
          Main constructor
 
Method Summary
 void AddNewPit(int x, int y)
          Add new pit in level
 void DoPitTick()
          Do for all pits one tick
 void Finishing()
          If all boxes are collected then replace invisible elements to visible elements
 int GetBoxNumber()
          Get number of gold boxes
 int GetManX()
          Get x hero position
 int GetManY()
          Get y hero position
 byte GetXY(int x, int y)
          Get element at x, y position (position as block)
 void LoadFromFile(java.net.URL level_name)
          Load all level data from file
 boolean ObjectInPit(int x, int y)
          Check that object in the pit
 void SetXY(int x, int y, byte element)
          Set element at x, y position
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

level_width

public byte level_width

level_height

public byte level_height

cell_width

public int cell_width

cell_height

public int cell_height

level_data

protected byte[][] level_data

man_x

protected int man_x

man_y

protected int man_y

total_enemy

public int total_enemy

enemy_coords

public int[][] enemy_coords

gold_box

protected int gold_box

on_finishing_stage

public boolean on_finishing_stage
Constructor Detail

CLevel

public CLevel()
Main constructor
Method Detail

LoadFromFile

public void LoadFromFile(java.net.URL level_name)
                  throws java.lang.Exception
Load all level data from file
Parameters:
level_name - URL of level

GetXY

public byte GetXY(int x,
                  int y)
Get element at x, y position (position as block)
Parameters:
x - X coordinate (in cells)
y - Y coordinate (in cells)
Returns:
Cell data

SetXY

public void SetXY(int x,
                  int y,
                  byte element)
Set element at x, y position
Parameters:
x - X coordinate (in cells)
y - Y coordinate (in cells)
element - Cell data

GetManX

public int GetManX()
Get x hero position
Returns:
hero x position (in pixels)

GetManY

public int GetManY()
Get y hero position
Returns:
hero y position (in pixels)

AddNewPit

public void AddNewPit(int x,
                      int y)
Add new pit in level
Parameters:
x - x position (in cells)
y - y position (in cells)

ObjectInPit

public boolean ObjectInPit(int x,
                           int y)
Check that object in the pit
Parameters:
x - object x position (in cells)
y - object y position (in cells)
Returns:
True - if object in the Pit, False - otherwise

DoPitTick

public void DoPitTick()
Do for all pits one tick

GetBoxNumber

public int GetBoxNumber()
Get number of gold boxes

Finishing

public void Finishing()
If all boxes are collected then replace invisible elements to visible elements