- All Implemented Interfaces:
IRenderable
The base entity class, which all game entities must extend
- Since:
- 0.3.0
- Author:
- AurumByte
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) javafx.geometry.Rectangle2DDeprecated.The components of each entityfloatheight of the entity(package private) booleanWhether 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) Vector2Position of the entityfloatRotation of the entity(package private) floatScale of the entity(package private) StringEntity tag, to help identify multiple entities from one anotherfloatwidth of the entity -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddComponent(Component component) Adds a component to the entityvoidaddComponents(Component... components) Adds multiple components to the entityvoidaddComponents(List<Component> components) Adds multiple components to the entitybooleancollidesWith(Entity other) Deprecated.Gets the center of the entityGets the components of the entitydoubleGets the height of the entityGets the position of the entity (where its drawn)floatGets the rotation of the entityfloatgetScale()Gets the scale of the entitygetTag()Gets the tag (name) of the entitydoublegetWidth()Gets the width of the entitybooleanisDead()Return if the entity is no longer used or notabstract voidrender(SypherEngine engine) The entity's render loopvoidrotate(float rotation) Sets the rotation of the entity (rotates the entity)voidsetBoundary(int xPos, int yPos, int width, int height) Deprecated.voidsetBoundary(javafx.geometry.Rectangle2D boundary) Deprecated.voidsetHeight(float height) Sets the height of the entityvoidsetIsDead(boolean dead) Set whether the entity is being used or notvoidsetPosition(float xPos, float yPos) Sets the position of the entity (where its drawn)voidsetScale(float scale) Sets the scale of the entityvoidSets the entity's tagvoidsetWidth(float width) Sets the width of the entitytoString()abstract voidupdate(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:
updatein interfaceIRenderable- Parameters:
deltaTime- The deltaTime- Since:
- 0.3.0
-
render
The entity's render loop
- Specified by:
renderin 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
-