Package com.csse3200.game.rendering
Class AnimationEffectsComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.rendering.RenderComponent
com.csse3200.game.rendering.AnimationRenderComponent
com.csse3200.game.rendering.AnimationEffectsComponent
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable,com.badlogic.gdx.utils.Json.Serializable,Renderable,Comparable<Renderable>
A component responsible for rendering animation effects using a TextureAtlas.
-
Field Summary
Fields inherited from class com.csse3200.game.rendering.AnimationRenderComponent
animationPlayTime, currentAnimation, timeSource -
Constructor Summary
ConstructorsConstructorDescriptionAnimationEffectsComponent(com.badlogic.gdx.graphics.g2d.TextureAtlas atlas) Initializes the AnimationEffectsComponent with the given TextureAtlas. -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddraw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Draws the current frame of the animation using the provided SpriteBatch.com.badlogic.gdx.math.Vector2getScale()Gets the scale used for rendering the animation.voidsetOffset(com.badlogic.gdx.math.Vector2 offset) Sets the offset for adjusting the position of the rendered animation.voidsetScale(com.badlogic.gdx.math.Vector2 scale) Sets the scale for adjusting the size of the rendered animation.Methods inherited from class com.csse3200.game.rendering.AnimationRenderComponent
addAnimation, addAnimation, create, dispose, getCurrentAnimation, getLayer, hasAnimation, isFinished, removeAnimation, scaleEntity, startAnimation, stopAnimation, togglePauseAnimationMethods inherited from class com.csse3200.game.rendering.RenderComponent
compareTo, getZIndex, renderMethods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, read, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update, write
-
Constructor Details
-
AnimationEffectsComponent
public AnimationEffectsComponent(com.badlogic.gdx.graphics.g2d.TextureAtlas atlas) Initializes the AnimationEffectsComponent with the given TextureAtlas.- Parameters:
atlas- The TextureAtlas containing animation frames.
-
-
Method Details
-
setOffset
public void setOffset(com.badlogic.gdx.math.Vector2 offset) Sets the offset for adjusting the position of the rendered animation.- Parameters:
offset- The Vector2 representing the offset in (x, y) coordinates.
-
setScale
public void setScale(com.badlogic.gdx.math.Vector2 scale) Sets the scale for adjusting the size of the rendered animation.- Parameters:
scale- The Vector2 representing the scale in (x, y) dimensions.
-
draw
protected void draw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Draws the current frame of the animation using the provided SpriteBatch.- Overrides:
drawin classAnimationRenderComponent- Parameters:
batch- The SpriteBatch used for rendering.
-
getScale
public com.badlogic.gdx.math.Vector2 getScale()Gets the scale used for rendering the animation.- Returns:
- A copy of the Vector2 representing the scale.
-