public abstract class EntityGame extends ObjectGame implements Body, Collidable, Mirrorable
Constructor and Description |
---|
EntityGame(SetupGame setup)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
collide(Collidable entity)
Check if the entity entered in collision with another one.
|
boolean |
collide(Rectangle area)
Check if the entity entered in collision with a specified area.
|
Rectangle |
getCollisionBounds()
Get collision representation.
|
CollisionData |
getCollisionData()
Get the current collision used.
|
Line |
getCollisionRay()
Get collision ray cast.
|
double |
getDistance(EntityGame entity)
Get the distance between the entity and the specified other entity.
|
int |
getHeight()
Get the height.
|
int |
getLocationIntX()
Get the current rounded horizontal location.
|
int |
getLocationIntY()
Get the current rounded vertical location.
|
double |
getLocationOldX()
Get the old horizontal location.
|
double |
getLocationOldY()
Get the old vertical location.
|
double |
getLocationX()
Get the current horizontal location.
|
double |
getLocationY()
Get the current vertical location.
|
double |
getMass()
Get body mass.
|
boolean |
getMirror()
Get current mirror state.
|
boolean |
getMirrorCancel()
Get mirror cancel state.
|
double |
getWeight()
Get body weight.
|
int |
getWidth()
Get the width.
|
void |
invertAxisY(boolean state)
True to invert Y axis.
|
void |
mirror(boolean state)
Set the next mirror state and apply it on next turn.
|
void |
moveLocation(double extrp,
double vx,
double vy)
Move location using a simple force.
|
void |
moveLocation(double extrp,
Force force,
Force... forces)
Move location using different forces.
|
void |
renderCollision(Graphic g,
CameraGame camera)
Render collision bounding box.
|
void |
resetGravity()
Reset gravity force (usually when hit the ground).
|
void |
setCollision(CollisionData collision)
Set the collision to use.
|
void |
setGravityMax(double max)
Set the maximum gravity value.
|
void |
setLocation(double x,
double y)
Set location instantly.
|
void |
setLocationX(double x)
Set horizontal location.
|
void |
setLocationY(double y)
Set vertical location.
|
void |
setMass(double mass)
Set body mass.
|
void |
setMirrorCancel(boolean state)
Set cancel state for the mirror operation.
|
void |
setSize(int width,
int height)
Set size.
|
void |
teleport(double x,
double y)
Teleport to a new location.
|
void |
teleportX(double x)
Teleport to a new horizontal location.
|
void |
teleportY(double y)
Teleport to a new vertical location.
|
abstract void |
update(double extrp)
Update the entity.
|
void |
updateCollision()
Update collision with specified area.
|
void |
updateGravity(double extrp,
int desiredFps,
Force... forces)
Update gravity calculation.
|
void |
updateMirror()
Update mirror and apply it if necessary.
|
destroy, getDataAnimation, getDataBoolean, getDataCollision, getDataDouble, getDataInteger, getDataRoot, getDataString, getId, isDestroyed, loadData
public EntityGame(SetupGame setup)
setup
- The setup reference.public abstract void update(double extrp)
extrp
- The extrapolation value.public double getDistance(EntityGame entity)
entity
- The entity to compare to.public void updateGravity(double extrp, int desiredFps, Force... forces)
Body
updateGravity
in interface Body
extrp
- The extrapolation value.desiredFps
- The desired fps (usually 60)forces
- The list of forces.public void resetGravity()
Body
resetGravity
in interface Body
public void invertAxisY(boolean state)
Body
invertAxisY
in interface Body
state
- The state.public void setGravityMax(double max)
Body
setGravityMax
in interface Body
max
- The maximum gravity value.public void setMass(double mass)
Body
public double getMass()
Body
public double getWeight()
Body
public void teleport(double x, double y)
Localizable
teleport
in interface Localizable
x
- The new horizontal location.y
- The new vertical location.public void teleportX(double x)
Localizable
teleportX
in interface Localizable
x
- The new horizontal location.public void teleportY(double y)
Localizable
teleportY
in interface Localizable
y
- The new vertical location.public void moveLocation(double extrp, Force force, Force... forces)
Localizable
moveLocation
in interface Localizable
extrp
- The extrapolation value.force
- The primary force.forces
- The other forces.public void moveLocation(double extrp, double vx, double vy)
Localizable
moveLocation
in interface Localizable
extrp
- The extrapolation value.vx
- The horizontal force.vy
- The vertical force.public void setLocation(double x, double y)
Localizable
setLocation
in interface Localizable
x
- The new horizontal location.y
- The new vertical location.public void setLocationX(double x)
Localizable
setLocationX
in interface Localizable
x
- The new horizontal location.public void setLocationY(double y)
Localizable
setLocationY
in interface Localizable
y
- The new vertical location.public void setSize(int width, int height)
Localizable
setSize
in interface Localizable
width
- The width.height
- The height.public double getLocationX()
Localizable
getLocationX
in interface Localizable
public double getLocationY()
Localizable
getLocationY
in interface Localizable
public int getLocationIntX()
Surface
getLocationIntX
in interface Surface
public int getLocationIntY()
Surface
getLocationIntY
in interface Surface
public double getLocationOldX()
Localizable
getLocationOldX
in interface Localizable
public double getLocationOldY()
Localizable
getLocationOldY
in interface Localizable
public int getWidth()
Surface
public int getHeight()
Surface
public void updateCollision()
Collidable
updateCollision
in interface Collidable
public void setCollision(CollisionData collision)
Collidable
setCollision
in interface Collidable
collision
- The collision to use (null
if none).public boolean collide(Collidable entity)
Collidable
collide
in interface Collidable
entity
- The opponent.true
if collide, false
else.public boolean collide(Rectangle area)
Collidable
collide
in interface Collidable
area
- The area to check.true
if collide, false
else.public void renderCollision(Graphic g, CameraGame camera)
Collidable
renderCollision
in interface Collidable
g
- The graphic output.camera
- The camera reference.public CollisionData getCollisionData()
Collidable
getCollisionData
in interface Collidable
public Rectangle getCollisionBounds()
Collidable
getCollisionBounds
in interface Collidable
public Line getCollisionRay()
Collidable
getCollisionRay
in interface Collidable
public void mirror(boolean state)
Mirrorable
mirror
in interface Mirrorable
state
- The next mirror state.public void updateMirror()
Mirrorable
updateMirror
in interface Mirrorable
public void setMirrorCancel(boolean state)
Mirrorable
setMirrorCancel
in interface Mirrorable
state
- The state.public boolean getMirrorCancel()
Mirrorable
getMirrorCancel
in interface Mirrorable
public boolean getMirror()
Mirrorable
getMirror
in interface Mirrorable
Copyright © 2014 Byron 3D Games Studio. All rights reserved.