|
||||||||||
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.Projectile<TProj>
TProj
- projectile type.public abstract class Projectile<TProj extends Projectile<TProj>>
Represent an entity which can thrown intances of itself. It already handle all created instance, and garbage collection. Can be used for things like bow, stone, fire...
Field Summary | |
---|---|
Damages |
damages
Projectile damages. |
protected AbstractEntry<?,?,?> |
source
Entrys references. |
protected AnimatedSprite |
sprite
Projectile animation. |
protected AbstractEntry<?,?,?> |
target
Entrys references. |
Fields inherited from class com.b3dgs.lionengine.game.Entity |
---|
collisionable, height, mirrorable, width, x, xOld, y, yOld |
Constructor Summary | |
---|---|
|
Projectile(java.awt.image.BufferedImage surface,
int hframes,
int vframes)
Create a new projectile. |
protected |
Projectile(Projectile<TProj> p)
Create a new sub projectile, ready to be thrown. |
Method Summary | |
---|---|
protected void |
clean()
Clean projectile before removing it. |
protected abstract TProj |
createInstance()
Create a projectile instance. |
AnimState |
getAnimState()
Get current animation state. |
int |
getFrame()
Get the current playing frame number. |
boolean |
isAlive()
Check if projectile is still alive. |
boolean |
isVisible()
Check if projectile is visible. |
void |
launch(AbstractEntry<?,?,?> src,
AbstractEntry<?,?,?> tgt)
Prepare a new projectile to be launched from souce to target. |
protected abstract void |
onDestoyed()
Action called when a projectile is destroyed, life's end. |
protected abstract void |
onHitTarget(AbstractEntry<?,?,?> target)
Action called when a projectile hit the target. |
protected abstract void |
onMove()
Action called when projectile is moving (alive). |
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,
Camera camera)
Render all projectiles on screen. |
protected void |
renderProjectile(java.awt.Graphics2D g,
Camera camera)
Render a single projectile on screen. |
void |
setFrame(int frame)
Set a fixed frame (it will overwrite the current animation). |
void |
setLifeTime(long time)
Set projectile life time, in millisecond. |
void |
setRelativeHit(boolean state)
True to accept collision even target moved (no dodge). |
void |
setSize(int width,
int height)
Set projectile size (collision area). |
void |
setSpeed(float speed)
Set projectile speed. |
void |
setVisibility(boolean state)
Set projectile visibility flag. |
void |
stopAnimation()
Stop current animation (animation state set to READY). |
protected void |
terminate()
Terminate projectile activity. |
void |
update(float extrp)
Update projectiles thrown. |
void |
updateAnimation(float extrp)
Animation update routine. |
protected void |
updateProjectile(float extrp)
Update thrown projectile routine. |
protected void |
updateVector()
Update projectile vector move from source to target. |
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 |
Methods inherited from interface com.b3dgs.lionengine.drawable.Animator |
---|
getRealFrame, setSkipLastFrameOnReverse |
Field Detail |
---|
public final Damages damages
protected final AnimatedSprite sprite
protected AbstractEntry<?,?,?> source
protected AbstractEntry<?,?,?> target
Constructor Detail |
---|
public Projectile(java.awt.image.BufferedImage surface, int hframes, int vframes)
surface
- surface reference.hframes
- horizontal frames.vframes
- vertical frames.protected Projectile(Projectile<TProj> p)
p
- projectile main reference.Method Detail |
---|
public void launch(AbstractEntry<?,?,?> src, AbstractEntry<?,?,?> tgt)
src
- launch source.tgt
- target.public void setRelativeHit(boolean state)
state
- relative state.public void update(float extrp)
extrp
- extrapolation value.public void render(java.awt.Graphics2D g, Camera camera)
g
- graphic output.camera
- camera reference.public void setSpeed(float speed)
speed
- projectile move speed.public void setSize(int width, int height)
width
- projectile width.height
- projectile height.public void setVisibility(boolean state)
state
- visibility flag.public boolean isVisible()
public boolean isAlive()
public void setLifeTime(long time)
time
- life time.protected abstract TProj createInstance()
protected void terminate()
protected void clean()
protected void updateVector()
protected void updateProjectile(float extrp)
extrp
- extrapolation value.protected void renderProjectile(java.awt.Graphics2D g, Camera camera)
g
- graphic output.camera
- camera reference.protected abstract void onMove()
protected abstract void onHitTarget(AbstractEntry<?,?,?> target)
target
- target hit.protected abstract void onDestoyed()
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 stopAnimation()
Animator
stopAnimation
in interface Animator
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 int getFrame()
Animator
getFrame
in interface Animator
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |