public abstract class EntityStrategy extends EntityGame implements com.b3dgs.lionengine.anim.Animator, Tiled
Modifier and Type | Field and Description |
---|---|
protected int |
offsetX
Entity location offset x.
|
protected int |
offsetY
Entity location offset y.
|
protected com.b3dgs.lionengine.drawable.SpriteAnimated |
sprite
Animation surface.
|
Constructor and Description |
---|
EntityStrategy(SetupSurfaceGame setup,
MapTileStrategy<?,?,?> map)
Create a new entity.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy() |
com.b3dgs.lionengine.anim.Animation |
getAnimationCurrent()
Get the current playing animation.
|
com.b3dgs.lionengine.anim.AnimState |
getAnimState() |
int |
getDistance(int tx,
int ty,
int tw,
int th,
boolean fromCenter)
Get distance in tile between the area.
|
int |
getDistanceInTile(Tiled tiled,
boolean fromCenter)
Get distance in tile between the specified tiled.
|
int |
getFov()
Get field of view value (in tile).
|
int |
getFrame() |
int |
getFrameAnim() |
int |
getHeightInTile() |
int |
getLayer()
Get current layer value.
|
int |
getLocationInTileX() |
int |
getLocationInTileY() |
int |
getOffsetX()
Get horizontal offset (used in case of rendering).
|
int |
getOffsetY()
Get vertical offset (used in case of rendering).
|
Orientation |
getOrientation()
Get current orientation.
|
int |
getPlayerId()
Get the player owner id.
|
int |
getWidthInTile() |
boolean |
isActive()
Check if entity is active.
|
boolean |
isAlive()
Check if entity is alive.
|
boolean |
isLayerChanged()
Check if layer has be changed.
|
boolean |
isOver()
Check if entity is currently over a cursor (hit by a cursor).
|
boolean |
isSelectable()
Check if entity is selectable.
|
boolean |
isSelected()
Check if entity is currently selected (hit by a cursor selection).
|
boolean |
isVisible()
Check if entity is visible.
|
void |
play(com.b3dgs.lionengine.anim.Animation anim) |
protected void |
removeRef()
Remove any map reference for this entity, around its size.
|
void |
render(com.b3dgs.lionengine.Graphic g,
CameraStrategy camera)
Render entity on screen depending of the camera.
|
protected void |
render(com.b3dgs.lionengine.Graphic g,
com.b3dgs.lionengine.drawable.Sprite sprite,
CameraStrategy camera,
int offsetX,
int offsetY)
Render a surface by using the camera referential.
|
void |
setActive(boolean state)
Set active state (false to disable mouse over and selection).
|
void |
setAlive(boolean state)
Set alive state.
|
void |
setAnimSpeed(double speed) |
void |
setFov(int fov)
Set field of view value (in tile).
|
void |
setFrame(int frame) |
void |
setLayer(int layer)
Define a layer number, used for rendering priority.
|
void |
setLocation(int tx,
int ty)
Set location in tile.
|
void |
setOrientation(Orientation orientation)
Set specific orientation.
|
void |
setOver(boolean state)
Set over state (used with cursor selection, to apply cursor over effect).
|
void |
setPlayerId(int id)
Set the player owner id.
|
void |
setSelectable(boolean state)
Set the selectable state.
|
void |
setSelection(boolean state)
Set selection state (used with cursor selection, to give an order).
|
void |
setVisible(boolean state)
Set visibility state.
|
abstract void |
stop()
Stop any action.
|
void |
stopAnimation() |
void |
update(double extrp) |
void |
updateAnimation(double extrp)
Deprecated.
already called in main loop. Has to be called only on specific cases.
|
collide, collide, getCollisionBounds, getCollisionData, getCollisionRay, getDistance, getHeight, getLocationIntX, getLocationIntY, getLocationOldX, getLocationOldY, getLocationX, getLocationY, getMass, getMirror, getMirrorCancel, getWeight, getWidth, invertAxisY, mirror, moveLocation, moveLocation, renderCollision, resetGravity, setCollision, setGravityMax, setLocation, setLocationX, setLocationY, setMass, setMirrorCancel, setSize, teleport, teleportX, teleportY, updateCollision, updateGravity, updateMirror
getDataAnimation, getDataBoolean, getDataCollision, getDataDouble, getDataInteger, getDataRoot, getDataString, getId, isDestroyed, loadData
protected final com.b3dgs.lionengine.drawable.SpriteAnimated sprite
protected final int offsetX
protected final int offsetY
public EntityStrategy(SetupSurfaceGame setup, MapTileStrategy<?,?,?> map)
<entity surface="sprite.png">
<frames horizontal="" vertical=""/>
<size width="" height=""/>
<offset x="" y=""/>
</entity>
setup
- The entity setup.map
- The map reference.public abstract void stop()
public void render(com.b3dgs.lionengine.Graphic g, CameraStrategy camera)
g
- The graphic output.camera
- The camera viewpoint.public void setLocation(int tx, int ty)
tx
- The horizontal tile location.ty
- The vertical tile location.public void setPlayerId(int id)
id
- The player owner id.public void setLayer(int layer)
HandlerEntityStrategy.LAYERS
. 0 is rendered firstly, last is rendered lastly.layer
- The layer number.public void setOrientation(Orientation orientation)
orientation
- The new orientation.public void setFov(int fov)
fov
- The field of view.public void setSelection(boolean state)
state
- The state.public void setOver(boolean state)
state
- The state.public void setActive(boolean state)
state
- The active state.public void setVisible(boolean state)
state
- The visibility state.public void setAlive(boolean state)
state
- The alive state.public void setSelectable(boolean state)
state
- The selectable state.public int getDistance(int tx, int ty, int tw, int th, boolean fromCenter)
tx
- The tile x.ty
- The tile y.tw
- The width in tile.th
- The height in tile.fromCenter
- true
to get distance from center only, false
from the global area.public int getDistanceInTile(Tiled tiled, boolean fromCenter)
tiled
- The tiled to check.fromCenter
- true
to get distance from center only, false
from the global area.public int getFov()
public int getPlayerId()
public Orientation getOrientation()
public int getLayer()
public com.b3dgs.lionengine.anim.Animation getAnimationCurrent()
public int getOffsetX()
public int getOffsetY()
public boolean isSelected()
true
if selected, false
else.public boolean isOver()
true
if over, false
else.public boolean isActive()
true
if active, false
else.public boolean isVisible()
public boolean isAlive()
true
if alive, false
else.public boolean isSelectable()
true
if selectable, false
else.public boolean isLayerChanged()
protected void render(com.b3dgs.lionengine.Graphic g, com.b3dgs.lionengine.drawable.Sprite sprite, CameraStrategy camera, int offsetX, int offsetY)
g
- The graphic output.sprite
- The sprite reference.camera
- The camera reference.offsetX
- The horizontal offset.offsetY
- The vertical offset.protected void removeRef()
public void update(double extrp)
update
in class EntityGame
public void destroy()
destroy
in class ObjectGame
public int getLocationInTileX()
getLocationInTileX
in interface Tiled
public int getLocationInTileY()
getLocationInTileY
in interface Tiled
public int getWidthInTile()
getWidthInTile
in interface Tiled
public int getHeightInTile()
getHeightInTile
in interface Tiled
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 setFrame(int frame)
setFrame
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 com.b3dgs.lionengine.anim.AnimState getAnimState()
getAnimState
in interface com.b3dgs.lionengine.anim.Animator
public void stopAnimation()
stopAnimation
in interface com.b3dgs.lionengine.anim.Animator
@Deprecated public void updateAnimation(double extrp)
updateAnimation
in interface com.b3dgs.lionengine.anim.Animator
Copyright © 2014 Byron 3D Games Studio. All rights reserved.