Class Entity
java.lang.Object
xyz.jeremynoesen.pseudo3d.core.util.Box
xyz.jeremynoesen.pseudo3d.core.object.Physics
xyz.jeremynoesen.pseudo3d.core.object.Entity
public class Entity extends Physics
Entity to be placed in a Scene, with Physics and a Sprite
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description boolean
canUpdateOffScreen()
Get whether the Entity can update when not visible on-screenboolean
equals(java.lang.Object o)
Check if this Entity is identical to anotherScene
getScene()
Get the Scene the Entity is infloat
getSpeed()
Get the speed modifier of the Entity for physics and renderingSprite
getSprite()
Get the Sprite of the Entityboolean
hasPhysics()
Check if the Entity has physics enabledboolean
isEnabled()
Check if the Entity is enabled in the Sceneboolean
isOnScreen()
Check if the Entity is shown on-screen
If the Entity has no Sprite, this will always be falseboolean
isVisible()
Check if the Entity is visible in renderingEntity
setEnabled(boolean enabled)
Set the Entity to be visible in the Scene and updatable in Physicsvoid
setOnScreen(boolean onScreen)
Set if the Entity is on-screen
Manually setting this will do nothing, as this value is automatically updated by the RendererEntity
setPhysics(boolean enabled)
Set the Entity to have physics or notEntity
setScene(Scene scene)
Set the Scene the Entity is inEntity
setSpeed(float speed)
Set the speed modifier for the Entity for physics and renderingEntity
setSprite(Sprite sprite)
Set the Sprite for the EntityEntity
setUpdateOffScreen(boolean updateOffScreen)
Set whether the Entity can update when not visible on-screenEntity
setVisible(boolean visible)
Set the Entity to be visible in renderingvoid
tickMotion(float deltaTime)
Update the motion of the EntityMethods inherited from class xyz.jeremynoesen.pseudo3d.core.object.Physics
getAcceleration, getCollideableSides, getCollidingObjects, getCollidingSides, getDrag, getFriction, getGravity, getKinematicAxes, getMass, getOverlappingObjects, getPushableAxes, getVelocity, isCollideable, isColliding, isColliding, isColliding, isColliding, isKinematic, isOverlapping, isPushable, isUpdatable, setAcceleration, setCollideable, setDrag, setDrag, setFriction, setFriction, setGravity, setKinematic, setMass, setPushable, setSceneObjects, setUpdatable, setVelocity, tickCollisions
Methods inherited from class xyz.jeremynoesen.pseudo3d.core.util.Box
contains, contains, getDepth, getDimensions, getFaceArea, getHeight, getMaximum, getMinimum, getPosition, getSurfaceArea, getVolume, getWidth, overlaps, setDepth, setDimensions, setDimensions, setHeight, setPosition, setWidth, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
Entity
public Entity()Create a new default Entity -
Entity
Copy constructor for Entities- Parameters:
entity
- Entity to copy
-
-
Method Details
-
getSprite
Get the Sprite of the Entity- Returns:
- Sprite of the Entity
-
setSprite
Set the Sprite for the Entity- Parameters:
sprite
- New Sprite- Returns:
- This Entity
-
isOnScreen
public boolean isOnScreen()Check if the Entity is shown on-screen
If the Entity has no Sprite, this will always be false- Returns:
- True if shown on-screen
-
setOnScreen
public void setOnScreen(boolean onScreen)Set if the Entity is on-screen
Manually setting this will do nothing, as this value is automatically updated by the Renderer- Parameters:
onScreen
- True when visible on-screen
-
canUpdateOffScreen
public boolean canUpdateOffScreen()Get whether the Entity can update when not visible on-screen- Returns:
- True if the Entity can update off-screen
-
setUpdateOffScreen
Set whether the Entity can update when not visible on-screen- Parameters:
updateOffScreen
- True to allow updating off-screen- Returns:
- This Entity
-
setScene
Set the Scene the Entity is in- Parameters:
scene
- Scene to place Entity in- Returns:
- This Entity
-
getScene
Get the Scene the Entity is in- Returns:
- Scene Entity is in
-
getSpeed
public float getSpeed()Get the speed modifier of the Entity for physics and rendering- Returns:
- Speed modifier value
-
setSpeed
Set the speed modifier for the Entity for physics and rendering- Parameters:
speed
- New speed modifier value- Returns:
- This Entity
-
tickMotion
public void tickMotion(float deltaTime)Update the motion of the Entity- Overrides:
tickMotion
in classPhysics
- Parameters:
deltaTime
- Time elapsed of the previous tick
-
isEnabled
public boolean isEnabled()Check if the Entity is enabled in the Scene- Returns:
- True if enabled
-
setEnabled
Set the Entity to be visible in the Scene and updatable in Physics- Parameters:
enabled
- True to enable Entity in Scene- Returns:
- This Entity
-
isVisible
public boolean isVisible()Check if the Entity is visible in rendering- Returns:
- True if visible
-
setVisible
Set the Entity to be visible in rendering- Returns:
- This Entity
-
hasPhysics
public boolean hasPhysics()Check if the Entity has physics enabled- Returns:
- True if Entity has physics
-
setPhysics
Set the Entity to have physics or not- Parameters:
enabled
- True to enable physics- Returns:
- This Entity
-
equals
public boolean equals(java.lang.Object o)Check if this Entity is identical to another
-