|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.b3dgs.lionengine.game.purviews.Configurable
com.b3dgs.lionengine.game.Entity
public class Entity
Main object that can be used by any higher level object for a game. It support external configuration, bounding box collision, and mirror.
Field Summary | |
---|---|
protected Collisionable |
collisionable
Collisionable object reference. |
protected int |
height
Entity size. |
protected Mirrorable |
mirrorable
Mirrorable object reference. |
protected int |
width
Entity size. |
protected float |
x
Real locations. |
protected float |
xOld
Real locations. |
protected float |
y
Real locations. |
protected float |
yOld
Real locations. |
Constructor Summary | |
---|---|
Entity()
Create a new blank entity. |
|
Entity(Configurable configurable)
Create a new entity from an existing configuration. |
Method Summary | |
---|---|
void |
backupCoord()
Save old locations. |
void |
cancelMirror(boolean state)
Set cancel state for the mirror operation. |
boolean |
collide(Entity entity)
Check if the entity entered in collision with another one. |
boolean |
collide(java.awt.geom.Rectangle2D area)
Check if the entity entered in collision with a specified area. |
boolean |
getCancelMirror()
Get mirror cancel state. |
java.awt.geom.Rectangle2D |
getCollision()
Get collision representation. |
int |
getHeight()
Get current height. |
boolean |
getMirror()
Get current mirror state. |
java.awt.geom.Line2D |
getRay()
Get collision ray cast. |
int |
getWidth()
Get current width. |
int |
getX()
Get position x. |
float |
getXOld()
Get old position x. |
float |
getXReal()
Get position x. |
int |
getY()
Get position y. |
float |
getYOld()
Get old position y. |
float |
getYReal()
Get position y. |
void |
invertYAxis(boolean invert)
Invert Y axis (recommended in case of platform game. |
void |
mirror(boolean state)
Set the next mirror state and apply it on next turn. |
void |
move(float vx,
float vy)
Move entity using specified vector. |
void |
place(int x,
int y)
Set location. |
void |
renderCollision(java.awt.Graphics2D g,
Camera camera)
Render collision bounding box. |
void |
updateCollision(int x,
int y,
int width,
int height)
Update collision with specified area. |
void |
updateMirror()
Update mirror and apply it if necessary. |
Methods inherited from class com.b3dgs.lionengine.game.purviews.Configurable |
---|
checkInstruction, getAnim, getCollArea, getData, getDataBool, getDataInt, getDataString, getRange, loadData |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final Collisionable collisionable
protected final Mirrorable mirrorable
protected float x
protected float y
protected float xOld
protected float yOld
protected int width
protected int height
Constructor Detail |
---|
public Entity()
public Entity(Configurable configurable)
configurable
- configuration reference.Method Detail |
---|
public void place(int x, int y)
x
- location x.y
- location y.public void move(float vx, float vy)
vx
- horizontal vector.vy
- vertical vector.public void backupCoord()
public int getX()
public int getY()
public float getXReal()
public float getYReal()
public float getXOld()
public float getYOld()
public int getWidth()
public int getHeight()
public void updateCollision(int x, int y, int width, int height)
Collisionable
updateCollision
in interface Collisionable
x
- horizontal offset from entity.y
- vertical offset from entity.width
- entity collision width.height
- entity collision height.public boolean collide(Entity entity)
Collisionable
collide
in interface Collisionable
entity
- opponent.
public boolean collide(java.awt.geom.Rectangle2D area)
Collisionable
collide
in interface Collisionable
area
- area to check.
public void invertYAxis(boolean invert)
Collisionable
invertYAxis
in interface Collisionable
invert
- inversion state.public void renderCollision(java.awt.Graphics2D g, Camera camera)
Collisionable
renderCollision
in interface Collisionable
g
- graphics output.camera
- camera reference.public java.awt.geom.Rectangle2D getCollision()
Collisionable
getCollision
in interface Collisionable
public java.awt.geom.Line2D getRay()
Collisionable
getRay
in interface Collisionable
public void mirror(boolean state)
Mirrorable
mirror
in interface Mirrorable
state
- next mirror state.public void updateMirror()
Mirrorable
updateMirror
in interface Mirrorable
public void cancelMirror(boolean state)
Mirrorable
cancelMirror
in interface Mirrorable
state
- state.public boolean getCancelMirror()
Mirrorable
getCancelMirror
in interface Mirrorable
public boolean getMirror()
Mirrorable
getMirror
in interface Mirrorable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |