public class MovableEntity extends AbstractEntity implements java.lang.Cloneable
#walk(boolean, boolean, boolean, boolean, float)
".GAME_DIAGLENGTH, GAME_DIAGLENGTH2, GAME_EDGELENGTH, GAME_EDGELENGTH2, OBJECTTYPESNUM, SCREEN_DEPTH, SCREEN_DEPTH2, SCREEN_DEPTH4, SCREEN_HEIGHT, SCREEN_HEIGHT2, SCREEN_HEIGHT4, SCREEN_WIDTH, SCREEN_WIDTH2, SCREEN_WIDTH4, VALUESNUM
Modifier | Constructor and Description |
---|---|
protected |
MovableEntity(int id,
int spritesPerDir)
Constructor of AbstractCharacter.
|
protected |
MovableEntity(MovableEntity entity) |
Modifier and Type | Method and Description |
---|---|
MovableEntity |
clone() |
void |
damage(int value)
called when gets damage
|
void |
dispose()
Deletes the object from the map.
|
com.badlogic.gdx.math.Vector3 |
getAiming()
Defines the direction of the gun - if no gun available - the direction of the head.
|
int |
getFriction() |
int |
getMana() |
com.badlogic.gdx.math.Vector3 |
getMovement() |
float |
getSpeed() |
void |
heal(float value)
heals the entity
|
boolean |
isColiding() |
boolean |
isCollectable() |
boolean |
isFloating()
Is the object be affected by gravity?
|
boolean |
isIndestructible() |
boolean |
isInLiquid()
Is the character standing in a liquid?
|
boolean |
isOnGround()
Checks if standing on blocks.
|
void |
jump()
This method should define what happens when the object jumps.
|
void |
jump(float velo)
Jump with a specific speed
|
void |
onCollide()
called when in contact with floor or wall.
|
void |
render(View view,
int xPos,
int yPos,
com.badlogic.gdx.graphics.Color color,
float scale)
Renders at a custom position with a custom light.
|
void |
setColiding(boolean coliding) |
void |
setCollectable(boolean collectable) |
void |
setDamageSounds(com.badlogic.gdx.audio.Sound[] sound) |
void |
setFallingSound(com.badlogic.gdx.audio.Sound fallingSound)
Sets the sound to be played when falling.
|
void |
setFloating(boolean floating)
Should the object be affected by gravity?
|
void |
setFriction(int friction)
autoamtically slows speed down.
|
void |
setIndestructible(boolean indestructible) |
void |
setJumpingSound(com.badlogic.gdx.audio.Sound jumpingSound)
Set the value of jumpingSound
|
void |
setLandingSound(com.badlogic.gdx.audio.Sound landingSound)
Set sound played when the character lands on the feet.
|
void |
setMana(int mana) |
void |
setMovement(com.badlogic.gdx.math.Vector3 movement)
normalises x and y
|
void |
setPosition(AbstractPosition pos)
Set the coordinates without safety check.
|
void |
setRunningSound(com.badlogic.gdx.audio.Sound runningSound)
Set the sound to be played when running.
|
void |
setSpeed(float speed) |
static void |
setWaterSound(com.badlogic.gdx.audio.Sound waterSound)
Set the value of waterSound
|
MovableEntity |
spawn(Point point)
add this entity to the map-> let it spawn
|
void |
update(float delta)
Updates the character.
|
getCategory, getDimensionZ, getName, getPosition, render, save, setDimensionZ, setHeight, shouldBeDisposed, spawned
getDrawCalls, getHealth, getId, getLightlevel, getPixmap, getRotation, getSprite, getSpriteId, getSprites, getSpritesheet, getValue, increaseDrawCalls, isHidden, isObstacle, isTransparent, loadSheet, render, render, render, render, render, render, resetDrawCalls, setGraphicsId, setHealth, setHidden, setLightlevel, setObstacle, setRotation, setTransparent, setValue, staticDispose, updateStaticUpdates
protected MovableEntity(int id, int spritesPerDir)
id
- spritesPerDir
- The number of animation sprites per walking direction. if 0 then it only uses the value 0protected MovableEntity(MovableEntity entity)
public MovableEntity spawn(Point point)
AbstractEntity
spawn
in class AbstractEntity
public void jump()
jump(float)
public void jump(float velo)
velo
- the velocity in m/spublic com.badlogic.gdx.math.Vector3 getAiming()
public void update(float delta)
update
in class AbstractEntity
delta
- time since last update in mspublic void render(View view, int xPos, int yPos, com.badlogic.gdx.graphics.Color color, float scale)
AbstractGameObject
render
in class AbstractGameObject
xPos
- rendering position, center of sprite (screen space?)yPos
- rendering position, center of sprite (screen space?)color
- custom blending colorscale
- relative valuepublic void setFallingSound(com.badlogic.gdx.audio.Sound fallingSound)
fallingSound
- public void setRunningSound(com.badlogic.gdx.audio.Sound runningSound)
runningSound
- public void setJumpingSound(com.badlogic.gdx.audio.Sound jumpingSound)
jumpingSound
- new value of jumpingSoundpublic void setLandingSound(com.badlogic.gdx.audio.Sound landingSound)
landingSound
- new value of landingSoundpublic static void setWaterSound(com.badlogic.gdx.audio.Sound waterSound)
waterSound
- new value of waterSoundpublic void setDamageSounds(com.badlogic.gdx.audio.Sound[] sound)
sound
- public com.badlogic.gdx.math.Vector3 getMovement()
public void setMovement(com.badlogic.gdx.math.Vector3 movement)
movement
- public float getSpeed()
public void setSpeed(float speed)
public boolean isColiding()
public void setColiding(boolean coliding)
public boolean isFloating()
public void setFloating(boolean floating)
floating
- public boolean isOnGround()
isOnGround
in class AbstractEntity
public boolean isInLiquid()
public void damage(int value)
value
- public void heal(float value)
value
- public boolean isIndestructible()
public void setIndestructible(boolean indestructible)
public int getMana()
public void setMana(int mana)
mana
- public int getFriction()
public void setFriction(int friction)
friction
- The higher the value, the more "slide". If =0 friciton is disabled.public void setPosition(AbstractPosition pos)
IsSelfAware
setPosition
in interface IsSelfAware
setPosition
in class AbstractEntity
pos
- public void onCollide()
public void dispose()
AbstractEntity
dispose
in class AbstractEntity
AbstractEntity.shouldBeDisposed()
public MovableEntity clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public boolean isCollectable()
public void setCollectable(boolean collectable)