public abstract class EntityPlatform extends EntityGame implements com.b3dgs.lionengine.anim.Animator
Modifier and Type | Field and Description |
---|---|
protected com.b3dgs.lionengine.drawable.SpriteAnimated |
sprite
Animation surface.
|
Constructor and Description |
---|
EntityPlatform(SetupSurfaceGame setup)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected <C extends Enum<C> & CollisionTile> |
addCollisionTile(CollisionTileCategory<C> type,
int offsetX,
int offsetY)
Define a tile collision at a specific offset from the entity referential.
|
boolean |
applyHorizontalCollision(Double x)
Apply an horizontal collision using the specified blocking x value.
|
boolean |
applyVerticalCollision(Double y)
Apply a vertical collision using the specified blocking y value.
|
com.b3dgs.lionengine.anim.AnimState |
getAnimState() |
<C extends Enum<C> & CollisionTile,T extends TilePlatform<C>,M extends MapTilePlatform<C,T>> |
getCollisionTile(M map,
CollisionTileCategory<C> category)
Get the first tile hit for the specified collision tile category matching the collision list.
|
protected <C extends Enum<C> & CollisionTile> |
getCollisionTileOffset(CollisionTileCategory<C> type)
Get the collision offset.
|
double |
getDiffHorizontal()
Get real horizontal speed (calculated on differential location x).
|
double |
getDiffVertical()
Get real vertical speed (calculated on differential location y).
|
int |
getFrame() |
int |
getFrameAnim() |
int |
getLocationIntX() |
int |
getLocationIntY() |
double |
getLocationOldX() |
double |
getLocationOldY() |
double |
getLocationX() |
double |
getLocationY() |
protected abstract void |
handleActions(double extrp)
Update actions, such as movements and attacks.
|
protected abstract void |
handleAnimations(double extrp)
Update animations, corresponding to a movement.
|
protected abstract void |
handleCollisions(double extrp)
Update collisions, after movements.
|
protected abstract void |
handleMovements(double extrp)
Update movement, depending of actions.
|
boolean |
isGoingDown()
Check if entity is going down.
|
boolean |
isGoingUp()
Check if entity is going up.
|
void |
play(com.b3dgs.lionengine.anim.Animation anim) |
void |
render(com.b3dgs.lionengine.Graphic g,
CameraPlatform camera)
Render on screen.
|
void |
renderAnim(com.b3dgs.lionengine.Graphic g,
com.b3dgs.lionengine.drawable.SpriteAnimated sprite,
CameraPlatform camera)
Render an animated sprite from the entity location, following camera view point.
|
void |
renderAnim(com.b3dgs.lionengine.Graphic g,
com.b3dgs.lionengine.drawable.SpriteAnimated sprite,
CameraPlatform camera,
int rx,
int ry)
Render an animated sprite from the entity location, following camera view point.
|
void |
setAnimSpeed(double speed) |
void |
setFrame(int frame) |
void |
setFrameOffsets(int frameOffsetX,
int frameOffsetY)
Set frame offsets (offsets on rendering).
|
void |
stopAnimation() |
void |
teleport(double x,
double y) |
void |
teleportX(double x) |
void |
teleportY(double y) |
void |
update(double extrp)
Main update routine.
|
void |
updateAnimation(double extrp) |
void |
updateMirror() |
collide, collide, getCollisionBounds, getCollisionData, getCollisionRay, getDistance, getHeight, getMass, getMirror, getMirrorCancel, getWeight, getWidth, invertAxisY, mirror, moveLocation, moveLocation, renderCollision, resetGravity, setCollision, setGravityMax, setLocation, setLocationX, setLocationY, setMass, setMirrorCancel, setSize, updateCollision, updateGravity
destroy, getDataAnimation, getDataBoolean, getDataCollision, getDataDouble, getDataInteger, getDataRoot, getDataString, getId, isDestroyed, loadData
protected com.b3dgs.lionengine.drawable.SpriteAnimated sprite
public EntityPlatform(SetupSurfaceGame setup)
It needs in its config file the frame description:
<entity>
<frames horizontal="" vertical=""/>
<size width="" height=""/>
</entity>
setup
- The entity setup.protected abstract void handleActions(double extrp)
extrp
- The extrapolation value.protected abstract void handleMovements(double extrp)
extrp
- The extrapolation value.protected abstract void handleCollisions(double extrp)
getCollisionTile(MapTilePlatform, CollisionTileCategory)
for each collision test.
Example:
@Override protected void handleCollisions(double extrp) { // Check something here // ... // Horizontal collision if (getDiffHorizontal() < 0) { checkHorizontal(EntityCollisionTileCategory.KNEE_LEFT); } else if (getDiffHorizontal() > 0) { checkHorizontal(EntityCollisionTileCategory.KNEE_RIGHT); } // Vertical collision if (getDiffVertical() < 0 || isOnGround()) { checkVertical(EntityCollisionTileCategory.LEG_LEFT); checkVertical(EntityCollisionTileCategory.LEG_RIGHT); checkVertical(EntityCollisionTileCategory.GROUND_CENTER); } }
extrp
- The extrapolation value.protected abstract void handleAnimations(double extrp)
extrp
- The extrapolation value.public void render(com.b3dgs.lionengine.Graphic g, CameraPlatform camera)
g
- The graphic output.camera
- The camera viewpoint.public void setFrameOffsets(int frameOffsetX, int frameOffsetY)
frameOffsetX
- The horizontal offset.frameOffsetY
- The vertical offset.public double getDiffHorizontal()
public double getDiffVertical()
public boolean isGoingUp()
true
if going up, false
else.public boolean isGoingDown()
true
if going down, false
else.public boolean applyHorizontalCollision(Double x)
x
- The blocking x value.true
if collision where applied.public boolean applyVerticalCollision(Double y)
y
- The blocking y value.true
if collision where applied.public void renderAnim(com.b3dgs.lionengine.Graphic g, com.b3dgs.lionengine.drawable.SpriteAnimated sprite, CameraPlatform camera)
g
- The graphics output.sprite
- The sprite to render.camera
- The camera reference.public void renderAnim(com.b3dgs.lionengine.Graphic g, com.b3dgs.lionengine.drawable.SpriteAnimated sprite, CameraPlatform camera, int rx, int ry)
g
- The graphics output.sprite
- The sprite to render.camera
- The camera reference.rx
- The horizontal rendering offset.ry
- The vertical rendering offset.protected <C extends Enum<C> & CollisionTile> void addCollisionTile(CollisionTileCategory<C> type, int offsetX, int offsetY)
C
- The collision type used.type
- The collision tile type.offsetX
- The horizontal offset value.offsetY
- The vertical offset value.protected <C extends Enum<C> & CollisionTile> CoordTile getCollisionTileOffset(CollisionTileCategory<C> type)
C
- The collision type used.type
- The collision category.public <C extends Enum<C> & CollisionTile,T extends TilePlatform<C>,M extends MapTilePlatform<C,T>> T getCollisionTile(M map, CollisionTileCategory<C> category)
C
- The collision type used.T
- The tile type used.M
- The map tile platform used.map
- The map reference.category
- The collision tile category.null
if none.public void update(double extrp)
update
in class EntityGame
extrp
- The extrapolation value.public void updateMirror()
updateMirror
in interface Mirrorable
updateMirror
in class EntityGame
public double getLocationX()
getLocationX
in interface Localizable
getLocationX
in class EntityGame
public double getLocationY()
getLocationY
in interface Localizable
getLocationY
in class EntityGame
public double getLocationOldX()
getLocationOldX
in interface Localizable
getLocationOldX
in class EntityGame
public double getLocationOldY()
getLocationOldY
in interface Localizable
getLocationOldY
in class EntityGame
public int getLocationIntX()
getLocationIntX
in interface Surface
getLocationIntX
in class EntityGame
public int getLocationIntY()
getLocationIntY
in interface Surface
getLocationIntY
in class EntityGame
public void teleport(double x, double y)
teleport
in interface Localizable
teleport
in class EntityGame
public void teleportX(double x)
teleportX
in interface Localizable
teleportX
in class EntityGame
public void teleportY(double y)
teleportY
in interface Localizable
teleportY
in class EntityGame
public void play(com.b3dgs.lionengine.anim.Animation anim)
play
in interface com.b3dgs.lionengine.anim.Animator
public void setAnimSpeed(double speed)
setAnimSpeed
in interface com.b3dgs.lionengine.anim.Animator
public void updateAnimation(double extrp)
updateAnimation
in interface com.b3dgs.lionengine.anim.Animator
public int getFrame()
getFrame
in interface com.b3dgs.lionengine.anim.Animator
public int getFrameAnim()
getFrameAnim
in interface com.b3dgs.lionengine.anim.Animator
public void stopAnimation()
stopAnimation
in interface com.b3dgs.lionengine.anim.Animator
public com.b3dgs.lionengine.anim.AnimState getAnimState()
getAnimState
in interface com.b3dgs.lionengine.anim.Animator
public void setFrame(int frame)
setFrame
in interface com.b3dgs.lionengine.anim.Animator
Copyright © 2014 Byron 3D Games Studio. All rights reserved.