public class ItemObject extends GameObject implements com.badlogic.gdx.utils.Pool.Poolable
Modifier and Type | Class and Description |
---|---|
static class |
ItemObject.ItemState
Stores the different possible state of an item object that is dropped into the world.
|
Constructor and Description |
---|
ItemObject()
Creates an ItemObject at bottom-center position (0,0).
|
ItemObject(int x,
int y)
Creates an Item GameObject at the given bottom-center (x,y) position.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canTarget()
An ItemObject can never be targetted.
|
Item |
getItem()
Gets the item represented by the ItemObject.
|
ItemObject.ItemState |
getItemState()
Gets the ItemState which determines which animation the object should be playing when dropped into the world.
|
void |
reset()
Called when an ItemObject is placed back into a pool.
|
void |
setItem(Item item)
Sets the item the GameObject contains and displays.
|
void |
setItemState(ItemObject.ItemState itemState)
Sets the ItemState which determines which animation the object should be playing when dropped into the world.
|
<T extends Item> |
spawn(float x,
float y,
float velocityMultiplier,
Human.Direction direction)
Spawns the item at the given position.
|
void |
update(float deltaTime)
Updates the GameObject's game logic.
|
getAcceleration, getCollider, getObjectId, getPosition, getPreviousPosition, getSkeleton, getStateTime, getTerrainCell, getVelocity, getX, getY, isAbove, moveTo, setAcceleration, setCollider, setObjectId, setPosition, setSkeleton, setStateTime, setTerrainCell, setVelocity, setVelocityX, setVelocityY, setX, setY, updateCollider, updatePosition
public ItemObject()
public ItemObject(int x, int y)
public void update(float deltaTime)
GameObject
update
in class GameObject
public <T extends Item> void spawn(float x, float y, float velocityMultiplier, Human.Direction direction)
velocityMultiplier
- Scalar by which velocity is multiplied, to allow certain items to fly further. Allows items to be spread apart if many are spawned.direction
- Specifies the direction in which the items fly when spawnedpublic boolean canTarget()
canTarget
in class GameObject
public ItemObject.ItemState getItemState()
public void setItemState(ItemObject.ItemState itemState)
public Item getItem()
public void setItem(Item item)
public void reset()
reset
in interface com.badlogic.gdx.utils.Pool.Poolable