|
||||||||||
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.AbstractEntity
com.b3dgs.lionengine.game.platform.AbstractPlatformEntity<TType>
TType
- tile type used.public abstract class AbstractPlatformEntity<TType extends DefaultTile>
Abstract and standard entity used for platform games. It already support gravity, animation and collisions.
Field Summary | |
---|---|
protected boolean |
borderLeft
Borders flag. |
protected boolean |
borderRight
Borders flag. |
protected int |
collOffX
Collisions special offsets. |
protected int |
collOffY
Collisions special offsets. |
Gravity |
gravity
Gravity handler. |
protected TileBasedMap<TType> |
map
Map reference. |
protected AnimatedSprite |
sprite
Animation surface. |
Fields inherited from class com.b3dgs.lionengine.game.Entity |
---|
collisionable, height, mirrorable, width, x, xOld, y, yOld |
Constructor Summary | |
---|---|
AbstractPlatformEntity(PlatformEntrySetup setup)
Create a new platform entity from an existing, sharing the same surface. |
Method Summary | |
---|---|
void |
applyXColl(int x)
Apply an horizontal collision using the specified blocking x value. |
void |
applyYColl(int y)
Apply a vertical collision using the specified blocking y value. |
protected TType |
checkCollision(int offsetX,
int offsetY)
Return the first hit tile which is flagged as collidable tile. |
protected boolean |
collisionTest(TType tile)
Can be overrided in case of specific tiles (ex: collision exception). |
AnimState |
getAnimState()
Get current animation state. |
int |
getFrame()
Get the current playing frame number. |
float |
getRealFrame()
Get the current playing frame with accurate precision. |
AnimatedSprite |
getSprite()
Get sprite surface. |
int |
getXInTile()
Get location x relative to map referential as tile. |
int |
getXOldInTile()
Get old location x relative to map referential as tile. |
int |
getXOldOnTile(TType tile)
Get old x value on tile referential (between 0 and tile width). |
int |
getXOnTile(TType tile)
Get x value on tile referential (between 0 and tile width). |
int |
getYInTile()
Get location y relative to map referential as tile. |
int |
getYOldInTile()
Get old location y relative to map referential as tile. |
int |
getYOldOnTile(TType tile)
Get old y value on tile referential (between 0 and tile height). |
int |
getYOnTile(TType tile)
Get y value on tile referential (between 0 and tile height). |
protected abstract void |
handleActions(float extrp)
Update actions, such as moves and attacks. |
protected abstract void |
handleAnimations()
Update data, corresponding to a movement. |
protected abstract void |
handleCollision()
Update collision, after movements. |
protected abstract void |
handleInputListener(Keyboard keyboard,
Mouse mouse)
Update input states, listen to inputs changes. |
protected abstract void |
handleMovement(float extrp)
Update movement, depending of actions. |
boolean |
isCheating()
Get cheating state. |
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 |
render(java.awt.Graphics2D g,
int offsetX,
int offsetY)
Render on screen. |
void |
render(java.awt.Graphics2D g,
PlatformCamera camera)
Render on screen. |
protected void |
renderAnim(java.awt.Graphics2D g,
AnimatedSprite sprite,
PlatformCamera camera)
Render an animated sprite from the entity location, following camera view point. |
protected void |
renderAnim(java.awt.Graphics2D g,
AnimatedSprite sprite,
PlatformCamera camera,
int rx,
int ry,
boolean mirror)
Render an animated sprite from the entity location, following camera view point. |
void |
renderCollisions(java.awt.Graphics2D g,
PlatformCamera camera)
Render collisions box area (used as debug). |
protected void |
setCheatsEnabled(boolean cheats)
Set cheats state. |
void |
setFrame(int frame)
Set a fixed frame (it will overwrite the current animation). |
void |
setMap(AbstractTileMap<TType> map)
Set map reference. |
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 |
stopAnimation()
Stop current animation (animation state set to READY). |
void |
update(Keyboard keyboard,
Mouse mouse,
float extrp)
Update routine. |
void |
updateAnimation(float extrp)
Deprecated. already called in update(...) function. |
protected void |
updateGravity(float extrp)
|
Methods inherited from class com.b3dgs.lionengine.game.AbstractEntity |
---|
getSpeed, getSpeedAdd, getSpeedAddDest, getSpeedDest, getSpeedMax, getSpeedReal, resetAllSpeed, setSize, setSpeed, setSpeedAdd, setSpeedAddDest, setSpeedDest, setSpeedMax, setX, setY |
Methods inherited from class com.b3dgs.lionengine.game.Entity |
---|
backupCoord, cancelMirror, collide, collide, getCancelMirror, getCollision, getHeight, getMirror, getRay, getWidth, getX, getXOld, getXReal, getY, getYOld, getYReal, invertYAxis, mirror, move, place, 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 Gravity gravity
protected final AnimatedSprite sprite
protected TileBasedMap<TType extends DefaultTile> map
protected boolean borderLeft
protected boolean borderRight
protected int collOffX
protected int collOffY
Constructor Detail |
---|
public AbstractPlatformEntity(PlatformEntrySetup setup)
setup
- entry setup.Method Detail |
---|
public void update(Keyboard keyboard, Mouse mouse, float extrp)
AbstractEntity
update
in class AbstractEntity
keyboard
- keyboard reference.mouse
- mouse reference.extrp
- extrapolation value.protected void updateGravity(float extrp)
protected abstract void handleInputListener(Keyboard keyboard, Mouse mouse)
keyboard
- keyboard reference.mouse
- mouse reference.protected abstract void handleActions(float extrp)
extrp
- extrapolation value.protected abstract void handleMovement(float extrp)
extrp
- extrapolation value.protected abstract void handleCollision()
protected abstract void handleAnimations()
public void render(java.awt.Graphics2D g, int offsetX, int offsetY)
g
- graphic output.offsetX
- horizontal offset.offsetY
- vertical offset.public void render(java.awt.Graphics2D g, PlatformCamera camera)
g
- graphic output.camera
- camera viewpoint.protected void renderAnim(java.awt.Graphics2D g, AnimatedSprite sprite, PlatformCamera camera)
g
- graphics output.sprite
- sprite to render.camera
- camera reference.protected void renderAnim(java.awt.Graphics2D g, AnimatedSprite sprite, PlatformCamera camera, int rx, int ry, boolean mirror)
g
- graphics output.sprite
- sprite to render.camera
- camera reference.rx
- horizontal rendering offset.ry
- vertical rendering offset.mirror
- apply mirror.public void renderCollisions(java.awt.Graphics2D g, PlatformCamera camera)
g
- graphic output.camera
- camera reference.protected TType checkCollision(int offsetX, int offsetY)
offsetX
- offsetY
-
protected boolean collisionTest(TType tile)
tile
- input tile.
protected void setCheatsEnabled(boolean cheats)
cheats
- true will enabled, false will disable.public boolean isCheating()
public void setMap(AbstractTileMap<TType> map)
map
- map reference.public int getXInTile()
public int getYInTile()
public int getXOldInTile()
public int getYOldInTile()
public int getXOnTile(TType tile)
tile
- tile referential.
public int getYOnTile(TType tile)
tile
- tile referential.
public int getXOldOnTile(TType tile)
tile
- tile referential.
public int getYOldOnTile(TType tile)
tile
- tile referential.
public void applyXColl(int x)
x
- blocking x value.public void applyYColl(int y)
y
- blocking y value.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 int getFrame()
Animator
getFrame
in interface Animator
public float getRealFrame()
Animator
getRealFrame
in interface Animator
public void stopAnimation()
Animator
stopAnimation
in interface Animator
@Deprecated public void updateAnimation(float extrp)
Animator
updateAnimation
in interface Animator
extrp
- extrapolation value.public AnimState getAnimState()
Animator
getAnimState
in interface Animator
AnimState
public void setFrame(int frame)
Animator
setFrame
in interface Animator
frame
- frame to set.public AnimatedSprite getSprite()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |