- All Implemented Interfaces:
IRenderable
The base entity class, which all game entities must extend
- Since:
- 0.3.0
- Author:
- AurumByte
- See Also:
-
Field Summary
Modifier and TypeFieldDescription(package private) javafx.geometry.Rectangle2D
Deprecated.The components of each entityfloat
height of the entity(package private) boolean
Whether the entity is no longer needed or notThe KeyListener for the current entity, which is an instance passed by the gamemanagerThe MouseListener for the current entity, which is an instance passed by the gamemanager(package private) Vector2
Position of the entityfloat
Rotation of the entity(package private) float
Scale of the entity(package private) String
Entity tag, to help identify multiple entities from one anotherfloat
width of the entity -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addComponent
(Component component) Adds a component to the entityvoid
addComponents
(Component... components) Adds multiple components to the entityvoid
addComponents
(List<Component> components) Adds multiple components to the entityboolean
collidesWith
(Entity other) Deprecated.Gets the center of the entityGets the components of the entitydouble
Gets the height of the entityGets the position of the entity (where its drawn)float
Gets the rotation of the entityfloat
getScale()
Gets the scale of the entitygetTag()
Gets the tag (name) of the entitydouble
getWidth()
Gets the width of the entityboolean
isDead()
Return if the entity is no longer used or notabstract void
render
(SypherEngine engine) The entity's render loopvoid
rotate
(float rotation) Sets the rotation of the entity (rotates the entity)void
setBoundary
(int xPos, int yPos, int width, int height) Deprecated.void
setBoundary
(javafx.geometry.Rectangle2D boundary) Deprecated.void
setHeight
(float height) Sets the height of the entityvoid
setIsDead
(boolean dead) Set whether the entity is being used or notvoid
setPosition
(float xPos, float yPos) Sets the position of the entity (where its drawn)void
setScale
(float scale) Sets the scale of the entityvoid
Sets the entity's tagvoid
setWidth
(float width) Sets the width of the entitytoString()
abstract void
update
(float deltaTime) The entity's update loop
-
Field Details
-
keyListener
The KeyListener for the current entity, which is an instance passed by the gamemanager -
mouseListener
The MouseListener for the current entity, which is an instance passed by the gamemanager -
position
Vector2 positionPosition of the entity -
rotation
public float rotationRotation of the entity -
scale
float scaleScale of the entity -
width
public float widthwidth of the entity -
height
public float heightheight of the entity -
isDead
boolean isDeadWhether the entity is no longer needed or not -
tag
String tagEntity tag, to help identify multiple entities from one another -
components
The components of each entity -
boundary
Deprecated.Boundary of the entity
-
-
Constructor Details
-
Entity
public Entity()
-
-
Method Details
-
update
public abstract void update(float deltaTime) The entity's update loop
- Specified by:
update
in interfaceIRenderable
- Parameters:
deltaTime
- The deltaTime- Since:
- 0.3.0
-
render
The entity's render loop
- Specified by:
render
in interfaceIRenderable
- Parameters:
engine
- the main engine- Since:
- 0.3.0
-
getPosition
Gets the position of the entity (where its drawn)
- Since:
- 0.3.0
-
setPosition
public void setPosition(float xPos, float yPos) Sets the position of the entity (where its drawn)
- Parameters:
xPos
- The position of the entity (x coord)yPos
- The position of the entity (y coord)- Since:
- 0.3.0
-
setHeight
public void setHeight(float height) Sets the height of the entity
- Parameters:
height
- The new height of the entity- Since:
- 0.3.0
-
setWidth
public void setWidth(float width) Sets the width of the entity
- Parameters:
width
- The new width of the entity- Since:
- 0.3.0
-
setScale
public void setScale(float scale) Sets the scale of the entity
- Parameters:
scale
- The new scale of the entity- Since:
- 0.3.0
-
rotate
public void rotate(float rotation) Sets the rotation of the entity (rotates the entity)
- Parameters:
rotation
- The value by which the object should be rotated- Since:
- 0.3.0
-
getRotation
public float getRotation()Gets the rotation of the entity
- Since:
- 0.3.0
-
getScale
public float getScale()Gets the scale of the entity
- Since:
- 0.3.0
-
getCenter
Gets the center of the entity
- Since:
- 0.3.0
-
getWidth
public double getWidth()Gets the width of the entity
- Since:
- 0.3.0
-
getHeight
public double getHeight()Gets the height of the entity
- Since:
- 0.3.0
-
getTag
Gets the tag (name) of the entity
- Since:
- 0.3.0
-
getComponents
Gets the components of the entity
- Since:
- 0.3.0
-
addComponent
Adds a component to the entity
- Parameters:
component
- The component to be added- Since:
- 0.3.0
-
addComponents
Adds multiple components to the entity
- Parameters:
components
- The components to be added- Since:
- 0.3.0
-
addComponents
Adds multiple components to the entity
- Parameters:
components
- The components to be added- Since:
- 0.3.0
-
isDead
public boolean isDead()Return if the entity is no longer used or not
- Since:
- 0.3.0
-
setIsDead
public void setIsDead(boolean dead) Set whether the entity is being used or not
- Parameters:
dead
- Toggle whether the entity is used or not- Since:
- 0.3.0
-
setBoundary
Deprecated. -
setBoundary
Deprecated. -
setTag
Sets the entity's tag
- Parameters:
tag
- The new tag of the entity- Since:
- 0.3.0
-
collidesWith
Deprecated. -
toString
-