|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.alienfactory.javamappy.Block
public class Block
A simple bean class which represents a Block
as used by
Mappy
.
A Block
may contain up to 4 layers of images (1 background layer
and 3 foreground layers), 7 fields of User data, quadratic collision
information and 4 other flags.
Field Summary | |
---|---|
static int |
ATTACH_NEXT
Used in Pillar Riser Mode to flag that the next Block
should continue the pillar. |
static int |
BACKGROUND
A Block image layer used to get / set its image index. |
static int |
BOTTOM
In conjunction with LEFT or RIGHT this
specifies a corner of the Block . |
static int |
FOREGROUND1
A Block image layer used to get / set its image index. |
static int |
FOREGROUND2
A Block image layer used to get / set its image index. |
static int |
FOREGROUND3
A Block image layer used to get / set its image index. |
static int |
LEFT
In conjunction with TOP or BOTTOM this
specifies a corner of the Block . |
static int |
LEFT_SIDE_PILLAR
Used in Pillar Riser Mode to flag that only the left hand side of the Block should be rendered. |
static int |
MAX_USER_DATA
A minimum index for User Data. |
static int |
MIN_USER_DATA
A minimum index for User Data. |
static int |
RIGHT
In conjunction with TOP or BOTTOM this
specifies a corner of the Block . |
static int |
RIGHT_SIDE_PILLAR
Used in Pillar Riser Mode to flag that only the right hand side of the Block should be rendered. |
static int |
TOP
In conjunction with LEFT or RIGHT this
specifies a corner of the Block . |
static int |
TRIGGER
A User defined flag. |
static int |
UNUSED1
A User defined flag. |
static int |
UNUSED2
A User defined flag. |
static int |
UNUSED3
A User defined flag. |
Constructor Summary | |
---|---|
Block()
|
Method Summary | |
---|---|
boolean |
getCollisionFlag(int flag)
Returns the specified collision flag. |
boolean |
getFlag(int flag)
Returns the specified flag. |
int |
getImageIndex(int imageLayer)
Returns the image index of the given Block layer. |
java.lang.String |
getTextString()
Returns the text string associated with this block. |
int |
getUserData(int index)
Returns the specified User Data. |
void |
setCollisionFlag(int flag,
boolean newFlag)
Sets the specified collision flag. |
void |
setFlag(int flag,
boolean newFlag)
Sets the specified flag to the given boolean value. |
void |
setImageIndex(int imageLayer,
int newImageIndex)
Sets the image index of the given Block layer. |
void |
setTextString(java.lang.String textString)
Sets the text string associated with this block. |
void |
setUserData(int index,
int newUserData)
Sets the specified User Data. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int LEFT
TOP
or BOTTOM
this
specifies a corner of the Block
. Used when getting / setting
a collision flag. 4
.
setCollisionFlag(int, boolean)
,
getCollisionFlag(int)
,
Constant Field Valuespublic static final int RIGHT
TOP
or BOTTOM
this
specifies a corner of the Block
. Used when getting / setting
a collision flag. 8
.
setCollisionFlag(int, boolean)
,
getCollisionFlag(int)
,
Constant Field Valuespublic static final int TOP
LEFT
or RIGHT
this
specifies a corner of the Block
. Used when getting / setting
a collision flag. 16
.
setCollisionFlag(int, boolean)
,
getCollisionFlag(int)
,
Constant Field Valuespublic static final int BOTTOM
LEFT
or RIGHT
this
specifies a corner of the Block
. Used when getting / setting
a collision flag. 32
.
setCollisionFlag(int, boolean)
,
getCollisionFlag(int)
,
Constant Field Valuespublic static final int BACKGROUND
Block
image layer used to get / set its image index. 0
.
setImageIndex(int, int)
,
getImageIndex(int)
,
Constant Field Valuespublic static final int FOREGROUND1
Block
image layer used to get / set its image index. 1
.
setImageIndex(int, int)
,
getImageIndex(int)
,
Constant Field Valuespublic static final int FOREGROUND2
Block
image layer used to get / set its image index. 2
.
setImageIndex(int, int)
,
getImageIndex(int)
,
Constant Field Valuespublic static final int FOREGROUND3
Block
image layer used to get / set its image index. 3
.
setImageIndex(int, int)
,
getImageIndex(int)
,
Constant Field Valuespublic static final int MIN_USER_DATA
1
.
setUserData(int, int)
,
getUserData(int)
,
Constant Field Valuespublic static final int MAX_USER_DATA
7
.
setUserData(int, int)
,
getUserData(int)
,
Constant Field Valuespublic static final int TRIGGER
0
.
setFlag(int, boolean)
,
getFlag(int)
,
Constant Field Valuespublic static final int UNUSED1
1
.
setFlag(int, boolean)
,
getFlag(int)
,
Constant Field Valuespublic static final int UNUSED2
2
.
setFlag(int, boolean)
,
getFlag(int)
,
Constant Field Valuespublic static final int UNUSED3
3
.
setFlag(int, boolean)
,
getFlag(int)
,
Constant Field Valuespublic static final int ATTACH_NEXT
Block
should continue the pillar. 1
.
setFlag(int, boolean)
,
getFlag(int)
,
Constant Field Valuespublic static final int LEFT_SIDE_PILLAR
Block
should be rendered. 2
.
setFlag(int, boolean)
,
getFlag(int)
,
Constant Field Valuespublic static final int RIGHT_SIDE_PILLAR
Block
should be rendered. 3
.
setFlag(int, boolean)
,
getFlag(int)
,
Constant Field ValuesConstructor Detail |
---|
public Block()
Method Detail |
---|
public void setImageIndex(int imageLayer, int newImageIndex) throws java.lang.IllegalArgumentException
Block
layer.
imageLayer
- should be one of BACKGROUND
,
FOREGROUND1
, FOREGROUND2
or
FOREGROUND3
newImageIndex
- the image index to be set
java.lang.IllegalArgumentException
- if imageLayer
is out of
bounds - it is assumed that newImageIndex
is validgetImageIndex(int)
public int getImageIndex(int imageLayer) throws java.lang.IllegalArgumentException
Block
layer.
imageLayer
- should be one of BACKGROUND
,
FOREGROUND1
, FOREGROUND2
or
FOREGROUND3
Block
layer.
java.lang.IllegalArgumentException
- if imageLayer
is out of
boundssetImageIndex(int, int)
public void setUserData(int index, int newUserData) throws java.lang.IllegalArgumentException
index
- the User Data to be updated.newUserData
- the new User Data.
java.lang.IllegalArgumentException
- if
(index
< MIN_USER_DATA
) or
(index
> MAX_USER_DATA
) orgetUserData(int)
public int getUserData(int index) throws java.lang.IllegalArgumentException
index
- the User Data to be returned.
java.lang.IllegalArgumentException
- if
(index
< MIN_USER_DATA
) or
(index
> MAX_USER_DATA
) orsetUserData(int, int)
public void setFlag(int flag, boolean newFlag) throws java.lang.IllegalArgumentException
flag
- should one of TRIGGER
, UNUSED1
,
UNUSED2
or UNUSED3
newFlag
- the new flag to set
java.lang.IllegalArgumentException
- if flag
is out of boundsgetFlag(int)
public boolean getFlag(int flag) throws java.lang.IllegalArgumentException
flag
- should be one of TRIGGER
, UNUSED1
,
UNUSED2
or UNUSED3
java.lang.IllegalArgumentException
- if flag
is out of boundssetFlag(int, boolean)
public void setCollisionFlag(int flag, boolean newFlag) throws java.lang.IllegalArgumentException
block.setCollisionFlag(TOP | LEFT, true);
flag
- should be a combination of LEFT
, RIGHT
,
TOP
and BOTTOM
newFlag
- the new Flag.
java.lang.IllegalArgumentException
- when flag
is not validgetCollisionFlag(int)
public boolean getCollisionFlag(int flag) throws java.lang.IllegalArgumentException
block.getCollisionFlag(BOTTOM | RIGHT);
flag
- should be a combination of LEFT
, RIGHT
,
TOP
and BOTTOM
java.lang.IllegalArgumentException
- when flag
is not validsetCollisionFlag(int, boolean)
public java.lang.String getTextString()
public void setTextString(java.lang.String textString)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |