|
||||||||||
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
com.b3dgs.lionengine.game.strategy.AbstractEntry<TTile,TSkill,TAttr>
TTile
- tile type used.TSkill
- skill type used.TAttr
- attributes type used.public abstract class AbstractEntry<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes>
This class represent the first abstraction for any kind of object which can be used in a strategy game. It contains a set of useful functions, a specific ID, a ready to use animated sprite, and a list of attributes. Entry data are automaticaly loaded, from the file data. It requires theses minimum instructions:
=RNG= #FRAMES# = {start-end} =INT= #ICON# = (value) =INT= #WIDTH# = (size) =INT= #HEIGHT# = (size) =INT= #OFFSET_X# = (value) // horizontal gfx offset =INT= #OFFSET_Y# = (value) // vertical gfx offset =INT= #MAX_LIFE# = (value)
AnimatedSprite
,
AbstractAttributes
Field Summary | |
---|---|
Animation |
anim
Current playing animation. |
protected java.lang.String |
animName
Current anim name. |
TAttr |
attr
Entry attributes. |
int |
icon
Entry icon number. |
int |
id
Entry id. |
protected AbstractEntry<TTile,TSkill,TAttr> |
lastAttacker
Last attacker reference. |
Alterable |
life
Entry life. |
PathBasedMap<TTile> |
map
Map reference. |
protected int |
offsetX
Entry location offset. |
protected int |
offsetY
Entry location offset. |
protected AnimatedSprite |
sprite
Animation surface. |
Fields inherited from class com.b3dgs.lionengine.game.Entity |
---|
collisionable, height, mirrorable, width, x, xOld, y, yOld |
Constructor Summary | |
---|---|
AbstractEntry(java.lang.String data,
PathBasedMap<TTile> map,
java.awt.image.BufferedImage surface,
TAttr attr)
Create a new entry. |
Method Summary | |
---|---|
void |
addSkill(TSkill skill)
Link skill to the entry. |
void |
applyOrder(AbstractEntry<TTile,TSkill,TAttr> target)
Apply choice from control panel by setting target and call skill action. |
void |
applyOrder(int dx,
int dy)
Apply choice from control panel by setting destination and call skill action. |
AnimState |
getAnimState()
Get current animation state. |
int |
getDistance(AbstractEntry<TTile,TSkill,TAttr> entry)
Get distance in tile between the specified entry. |
int |
getDistance(int tx,
int ty,
int tw,
int th)
Get distance in tile between the area. |
int |
getFieldOfView()
Get field of view value (in tile). |
int |
getFrame()
Get the current playing frame number. |
int |
getHeight()
Get entry height (it may not be the collision area, it is only the real size). |
int |
getHeightInTile()
Get entry height int tile. |
int |
getLayer()
Get current layer value. |
int |
getLayerOld()
Get last layer value, before changes. |
TSkill |
getOrderedSkill()
Get ordered skill reference. |
int |
getOwnerID()
Get owner id (player id owning this entry). |
float |
getRealFrame()
Get the current playing frame with accurate precision. |
TSkill |
getSkill(java.lang.String name)
Get a skill from its id. |
java.util.Collection<TSkill> |
getSkills()
Get all skills as collection (iterable). |
int |
getWidth()
Get entry width (it may not be the collision area, it is only the real size). |
int |
getWidthInTile()
Get entry width in tile. |
int |
getXInTile()
Get horizontal tile location. |
int |
getXOffset()
Get horizontal offset (used in case of rendering). |
int |
getYInTile()
Get vertical tile location. |
int |
getYOffset()
Get vertical offset (used in case of rendering). |
boolean |
hasChangedLayer()
Check if layer has be changed. |
boolean |
isActive()
Check if entry is active. |
boolean |
isAlive()
Check if entry is alive. |
boolean |
isOver()
Check if entry is currently over a cursor (hit by a cursor). |
boolean |
isRemoved()
Check if entry is still existing. |
boolean |
isSelected()
Check if entry is currently selected (hit by a cursor selection). |
boolean |
isUnselected()
Check if entry has just been unselected. |
boolean |
isVisible()
Check if entry is visible. |
void |
onHit(AbstractEntry<TTile,TSkill,TAttr> attacker)
Action called when entry is hiting another one. |
abstract void |
onKilled(AbstractEntry<TTile,TSkill,TAttr> attacker)
Action called when entry is killed by another one. |
void |
onOrdered(TSkill skill)
Action called when entry applyed an order (action selected from control panel). |
abstract void |
onOrderedFail(TSkill skill)
Action called when entry order failed. |
abstract void |
onSelection()
Action called when entry is selected (in case of a single selection). |
void |
place(int tx,
int ty)
Set specific location in tile. |
void |
play(Animation anim)
Play the animated sprite with a specific animation, previously created. |
void |
play(Animation anim,
float speed)
Play the animated sprite with a specific animation, previously created. |
void |
play(int start,
int end,
float speed,
boolean reverse,
boolean repeat)
Play the animated sprite with a specific animation data. |
void |
remove()
Remove entry from world, and free memory. |
protected void |
removeRef()
Remove any map ref for this entry, arround its size. |
void |
removeSkill(java.lang.String name)
Remove a skill. |
void |
render(java.awt.Graphics2D g,
Camera camera)
Render entry on screen depending of the camera. |
void |
setActive(boolean state)
Set active state (false to cancel update). |
void |
setAlive(boolean state)
Set alive state. |
void |
setAnimation(java.lang.String anim)
Change animation by a new one from its name. |
void |
setFieldOfView(int fov)
Set field of view value (in tile). |
void |
setFrame(int frame)
Set a fixed frame (it will overwrite the current animation). |
void |
setLayer(int layer)
Define a layer number, used for rendering priority. |
void |
setLayerChanged(boolean state)
Set layer changes state. |
void |
setOrderedSkill(TSkill skill)
Set reference from chosen skill in control panel. |
void |
setOver(boolean state)
Set over state (used with cursor selection, to apply cursor over effect). |
void |
setOwnerID(int id)
Set owner id (player id owning this entry). |
void |
setSelection(boolean state)
Set selection state (used with cursor selection, to give an order). |
void |
setSkipLastFrameOnReverse(boolean skip)
Skip last frame when reverse playing is enable It will directly play the last-1 frame when reversing if set to true. |
void |
setVisibility(boolean state)
Set visibility state. |
void |
stopAnimation()
Stop current animation (animation state set to READY). |
void |
unselect()
This will unselect entry. |
void |
update(Keyboard keyboard,
Mouse mouse,
float extrp)
Main routine, has to be called in a game loop. |
void |
updateAnimation(float extrp)
Deprecated. already called in main loop. Has to be called only on specific cases. |
Methods inherited from class com.b3dgs.lionengine.game.Entity |
---|
backupCoord, cancelMirror, collide, collide, getCancelMirror, getCollision, getMirror, getRay, getX, getXOld, getXReal, getY, getYOld, getYReal, invertYAxis, mirror, move, renderCollision, updateCollision, updateMirror |
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 |
---|
public final TAttr extends AbstractAttributes attr
public final Alterable life
public final int id
public final int icon
public final PathBasedMap<TTile extends AbstractPathTile> map
protected final AnimatedSprite sprite
public final Animation anim
protected int offsetX
protected int offsetY
protected java.lang.String animName
protected AbstractEntry<TTile extends AbstractPathTile,TSkill extends AbstractSkill<TTile,TSkill,TAttr>,TAttr extends AbstractAttributes> lastAttacker
Constructor Detail |
---|
public AbstractEntry(java.lang.String data, PathBasedMap<TTile> map, java.awt.image.BufferedImage surface, TAttr attr)
data
- entry data file path.map
- map reference.surface
- building image file path.attr
- attributes reference.Method Detail |
---|
public void update(Keyboard keyboard, Mouse mouse, float extrp)
keyboard
- keyboard reference.mouse
- mouse reference.extrp
- extrapolation value.public void render(java.awt.Graphics2D g, Camera camera)
g
- graphics output.camera
- camera viewpoint.protected void removeRef()
public void setLayer(int layer)
layer
- layer number [0-3].public int getLayer()
public int getLayerOld()
public void setLayerChanged(boolean state)
state
- public boolean hasChangedLayer()
public void place(int tx, int ty)
place
in class Entity
tx
- horizontal tile location.ty
- vertical tile location.public int getXInTile()
public int getYInTile()
public int getXOffset()
public int getYOffset()
public int getWidth()
getWidth
in class Entity
public int getHeight()
getHeight
in class Entity
public int getWidthInTile()
public int getHeightInTile()
public int getDistance(int tx, int ty, int tw, int th)
tx
- tile x.ty
- tile y.tw
- width in tile.th
- height in tile.
public int getDistance(AbstractEntry<TTile,TSkill,TAttr> entry)
entry
- entry to check.
public void setFieldOfView(int fov)
fov
- field of view.public int getFieldOfView()
public void play(Animation anim)
Animator
play
in interface Animator
anim
- animation reference.public void play(Animation anim, float speed)
Animator
play
in interface Animator
anim
- animation reference.speed
- specified speed.public void play(int start, int end, float speed, boolean reverse, boolean repeat)
Animator
play
in interface Animator
start
- first frame to play.end
- last frame to reach.speed
- specified speed.reverse
- reverse play when end is reached.repeat
- play in loop.public void setSkipLastFrameOnReverse(boolean skip)
Animator
setSkipLastFrameOnReverse
in interface Animator
public void setAnimation(java.lang.String anim)
anim
- animation name.public void setFrame(int frame)
Animator
setFrame
in interface Animator
frame
- frame to set.public int getFrame()
Animator
getFrame
in interface Animator
public float getRealFrame()
Animator
getRealFrame
in interface Animator
public AnimState getAnimState()
Animator
getAnimState
in interface Animator
AnimState
public void stopAnimation()
Animator
stopAnimation
in interface Animator
@Deprecated public void updateAnimation(float extrp)
Animator
updateAnimation
in interface Animator
extrp
- extrapolation value.public void addSkill(TSkill skill)
skill
- skill to add.public TSkill getSkill(java.lang.String name)
name
- skill name.
public void removeSkill(java.lang.String name)
name
- skill name.public java.util.Collection<TSkill> getSkills()
public void setSelection(boolean state)
state
- state.public void setOver(boolean state)
state
- state.public boolean isSelected()
public void unselect()
public boolean isUnselected()
public boolean isOver()
public void setActive(boolean state)
state
- active state.public boolean isActive()
public void setVisibility(boolean state)
state
- visibility state.public boolean isVisible()
public void setOwnerID(int id)
id
- owner id.public int getOwnerID()
public void setAlive(boolean state)
state
- alive state.public boolean isAlive()
public boolean isRemoved()
public void remove()
public void setOrderedSkill(TSkill skill)
skill
- chosen skill in control panel.public TSkill getOrderedSkill()
public void applyOrder(int dx, int dy)
dx
- horizontal map tile location.dy
- vertical map tile location.public void applyOrder(AbstractEntry<TTile,TSkill,TAttr> target)
target
- target reference.public abstract void onSelection()
public void onOrdered(TSkill skill)
skill
- ordered skillpublic abstract void onOrderedFail(TSkill skill)
skill
- ordered skillpublic void onHit(AbstractEntry<TTile,TSkill,TAttr> attacker)
attacker
- attacker reference.public abstract void onKilled(AbstractEntry<TTile,TSkill,TAttr> attacker)
attacker
- attacker reference.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |