Class Bullet
- java.lang.Object
-
- com.badlogic.gdx.graphics.g3d.Renderable
-
- com.bombinggames.wurfelengine.core.gameobjects.AbstractGameObject
-
- com.bombinggames.wurfelengine.core.gameobjects.AbstractEntity
-
- com.bombinggames.wurfelengine.core.gameobjects.MovableEntity
-
- com.bombinggames.wurfelengine.extension.shooting.Bullet
-
public class Bullet extends MovableEntity
A bullet is a moving object which can destroy and damage entities or the world.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.bombinggames.wurfelengine.core.gameobjects.AbstractEntity
colissionRadius
-
Fields inherited from class com.bombinggames.wurfelengine.core.gameobjects.AbstractGameObject
sprite
-
-
Constructor Summary
Constructors Constructor Description Bullet()
You can set a different sprite viaAbstractEntity.setSpriteId(byte)
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
Deletes the object from the map and every other container.int
getDistance()
boolean
handleMessage(com.badlogic.gdx.ai.msg.Telegram msg)
void
ignoreCoord(Coordinate coord)
void
setDamage(byte damage)
void
setExplosive(int ex)
void
setImpactSprite(int id)
Set the sprite which get spawned when the bullet hits.void
setMaxDistance(float maxDistance)
MovableEntity
spawn(Point point)
Add this entity to the map-> let it spawnvoid
update(float dt)
Updates the character.-
Methods inherited from class com.bombinggames.wurfelengine.core.gameobjects.AbstractEntity
addComponent, collidesWith, getCollidingEntities, getCollidingEntities, getComponents, getComponents, getCoord, getCoveredBlocks, getDimensionZ, getHealth, getLightlevelB, getLightlevelG, getLightlevelR, getMass, getName, getPoint, getPosition, getRegisteredEntities, getSpriteCategory, getSpriteId, getSpriteValue, hasPosition, heal, isIndestructible, isInMemoryArea, isMarkedDS, isSavedPersistent, markAsVisitedDS, registerEngineEntities, registerEntity, removeComponent, removeFromMap, requestChunk, setDamageSounds, setDimensionZ, setHealth, setIndestructible, setLightlevel, setMass, setName, setPosition, setPosition, setSavePersistent, setSpriteCategory, setSpriteId, setSpriteValue, setUseRawDelta, shouldBeDisposed, takeDamage, useRawDelta
-
Methods inherited from class com.bombinggames.wurfelengine.core.gameobjects.AbstractGameObject
getColor, getDepth, getPixmap, getRotation, getScaling, getSprite, getSprite, getSpritesheet, getSpritesheetPath, getTextureDiffuse, getTextureNormal, isHidden, loadSheet, render, render, setColor, setCustomSpritesheet, setHidden, setRotation, setScaling, shouldBeRendered, staticDispose, updateSpriteCache
-
Methods inherited from class com.bombinggames.wurfelengine.core.gameobjects.MovableEntity
addMovement, addMovement, addMovement, addToHor, collidesWithWorld, getAiming, getFriction, getMovement, getMovementHor, getOrientation, getSpeed, getSpeedHor, isColiding, isFloating, isInLiquid, isOnCeil, isOnGround, jump, jump, pauseMovementAnimation, playMovementAnimation, setColiding, setContinuousWalkingAnimation, setFallingSound, setFloating, setFriction, setHorMovement, setJumpingSound, setMovement, setMovement, setOrientation, setRunningSound, setSpeedHorizontal, setSpeedIncludingZ, setStepSound1Grass, setWalkingAnimationCycling, setWalkingStepMode, setWaterSound, step, updateSprite
-
-
-
-
Constructor Detail
-
Bullet
public Bullet()
You can set a different sprite viaAbstractEntity.setSpriteId(byte)
. It uses the engine default sprite.- See Also:
AbstractEntity.setSpriteId(byte)
-
-
Method Detail
-
spawn
public MovableEntity spawn(Point point)
Description copied from class:AbstractEntity
Add this entity to the map-> let it spawn- Overrides:
spawn
in classMovableEntity
- Parameters:
point
- the point in the game world where the object is. If it was previously set this is ignored.- Returns:
- returns itself
-
update
public void update(float dt)
Description copied from class:MovableEntity
Updates the character. Applies gravitation.- Overrides:
update
in classMovableEntity
- Parameters:
dt
- time since last update in ms
-
setMaxDistance
public void setMaxDistance(float maxDistance)
- Parameters:
maxDistance
- in game space
-
setDamage
public void setDamage(byte damage)
- Parameters:
damage
-
-
setExplosive
public void setExplosive(int ex)
- Parameters:
ex
-
-
dispose
public void dispose()
Description copied from class:AbstractEntity
Deletes the object from the map and every other container. The opposite to spawn() but also sets a flag to remove it completely.- Overrides:
dispose
in classMovableEntity
- See Also:
AbstractEntity.shouldBeDisposed()
,AbstractEntity.removeFromMap()
-
setImpactSprite
public void setImpactSprite(int id)
Set the sprite which get spawned when the bullet hits.- Parameters:
id
- if you don't want an impact sprite set id to0.
-
getDistance
public int getDistance()
- Returns:
- the distance traveled.
-
ignoreCoord
public void ignoreCoord(Coordinate coord)
- Parameters:
coord
-
-
handleMessage
public boolean handleMessage(com.badlogic.gdx.ai.msg.Telegram msg)
- Overrides:
handleMessage
in classMovableEntity
-
-