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 booleancanUpdateOffScreen()Get whether the Entity can update when not visible on-screenbooleanequals(java.lang.Object o)Check if this Entity is identical to anotherScenegetScene()Get the Scene the Entity is infloatgetSpeed()Get the speed modifier of the Entity for physics and renderingSpritegetSprite()Get the Sprite of the EntitybooleanhasPhysics()Check if the Entity has physics enabledbooleanisEnabled()Check if the Entity is enabled in the ScenebooleanisOnScreen()Check if the Entity is shown on-screen
If the Entity has no Sprite, this will always be falsebooleanisVisible()Check if the Entity is visible in renderingEntitysetEnabled(boolean enabled)Set the Entity to be visible in the Scene and updatable in PhysicsvoidsetOnScreen(boolean onScreen)Set if the Entity is on-screen
Manually setting this will do nothing, as this value is automatically updated by the RendererEntitysetPhysics(boolean enabled)Set the Entity to have physics or notEntitysetScene(Scene scene)Set the Scene the Entity is inEntitysetSpeed(float speed)Set the speed modifier for the Entity for physics and renderingEntitysetSprite(Sprite sprite)Set the Sprite for the EntityEntitysetUpdateOffScreen(boolean updateOffScreen)Set whether the Entity can update when not visible on-screenEntitysetVisible(boolean visible)Set the Entity to be visible in renderingvoidtickMotion(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, tickCollisionsMethods 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, toStringMethods 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:
tickMotionin 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
-