java.lang.Object
dev.aurumbyte.sypherengine.ecs.Entity
dev.aurumbyte.sypherengine.ecs.Sprite2D
- All Implemented Interfaces:
IRenderable
The Sprite class, basically a wrapper over entity, which makes stuff easier.
- Since:
- 0.3.0
- Author:
- AurumByte
-
Field Summary
Modifier and TypeFieldDescription(package private) Animator2D
The animator, which contains sprite animations.(package private) javafx.scene.image.Image
The sprite image, could be an image tileFields inherited from class dev.aurumbyte.sypherengine.ecs.Entity
boundary, components, height, isDead, keyListener, mouseListener, position, rotation, scale, tag, width
-
Constructor Summary
ConstructorDescriptionSprite2D
(Animator2D animator2D, float xPos, float yPos) Create a new Sprite with just one image as a sprite imageSprite2D
(javafx.scene.image.Image spriteImage, float xPos, float yPos) Create a new Sprite with just one image as a sprite image -
Method Summary
Modifier and TypeMethodDescriptionvoid
render
(SypherEngine engine) The render loop for the entity, the base of the spritevoid
update
(float deltaTime) The update loop for the entity, the base of the spriteabstract void
updateSprite
(float deltaTime) The update loop for a spriteMethods inherited from class dev.aurumbyte.sypherengine.ecs.Entity
addComponent, addComponents, addComponents, collidesWith, getCenter, getComponents, getHeight, getPosition, getRotation, getScale, getTag, getWidth, isDead, rotate, setBoundary, setBoundary, setHeight, setIsDead, setPosition, setScale, setTag, setWidth, toString
-
Field Details
-
image
javafx.scene.image.Image imageThe sprite image, could be an image tile -
animator2D
Animator2D animator2DThe animator, which contains sprite animations.
-
-
Constructor Details
-
Sprite2D
public Sprite2D(javafx.scene.image.Image spriteImage, float xPos, float yPos) Create a new Sprite with just one image as a sprite image
- Parameters:
spriteImage
- The sprite imagexPos
- Position of sprite (x coords)yPos
- Position of sprite (y coords)
-
Sprite2D
Create a new Sprite with just one image as a sprite image
- Parameters:
animator2D
- The sprite animation enginexPos
- Position of sprite (x coords)yPos
- Position of sprite (y coords)
-
-
Method Details
-
updateSprite
public abstract void updateSprite(float deltaTime) The update loop for a sprite
- Parameters:
deltaTime
- The deltaTime of the engine
-
update
public void update(float deltaTime) The update loop for the entity, the base of the sprite
- Specified by:
update
in interfaceIRenderable
- Specified by:
update
in classEntity
- Parameters:
deltaTime
- The deltaTime
-
render
The render loop for the entity, the base of the sprite
- Specified by:
render
in interfaceIRenderable
- Specified by:
render
in classEntity
- Parameters:
engine
- The engine
-