Module SypherEngine

Class Animator2D

java.lang.Object
dev.aurumbyte.sypherengine.components.Component
dev.aurumbyte.sypherengine.components.Animator2D

public class Animator2D extends Component
A sprite animation class, using individual images as frames rather than a tileset, is experimental
Since:
v0.4.0
Author:
AurumByte
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) int
    The speed of animation to be played
    (package private) List<javafx.scene.image.Image>
    The frames to be animated upon

    Fields inherited from class dev.aurumbyte.sypherengine.components.Component

    componentTag
  • Constructor Summary

    Constructors
    Constructor
    Description
    Animator2D(List<javafx.scene.image.Image> frames)
    Create an animator with specified frames
    Animator2D(javafx.scene.image.Image[] frames)
    Create an animator with specified frames
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addFrame(javafx.scene.image.Image frame)
    Adding a frame to the animation
    void
    addFrames(javafx.scene.image.Image[] frames)
    Adding multiple frames to the animation
    int
    Getting how many frames are present in the animation
    List<javafx.scene.image.Image>
    Getting the frames present in the animation
    void
    removeFrame(javafx.scene.image.Image frame)
    Removing a frame from the animation
    void
    removeFrames(javafx.scene.image.Image[] frames)
    Removing multiple frames from the animation
    void
    Rendering the frames
    void
    setFrames(List<javafx.scene.image.Image> frames)
    Setting the frames present in the animation
    void
    setFrames(javafx.scene.image.Image[] frames)
    Setting the frames present in the animation
    void
    update(float deltaTime)
    Updating the Animation

    Methods inherited from class dev.aurumbyte.sypherengine.components.Component

    getAABBComponent

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • frames

      List<javafx.scene.image.Image> frames
      The frames to be animated upon
    • animationSpeed

      int animationSpeed
      The speed of animation to be played
  • Constructor Details

    • Animator2D

      public Animator2D(List<javafx.scene.image.Image> frames)
      Create an animator with specified frames
    • Animator2D

      public Animator2D(javafx.scene.image.Image[] frames)
      Create an animator with specified frames
  • Method Details

    • update

      public void update(float deltaTime)

      Updating the Animation

      Specified by:
      update in class Component
      Parameters:
      deltaTime - DeltaTime, the duration taken to update a frame
      Since:
      0.4.0
    • render

      public void render(SypherEngine engine)

      Rendering the frames

      Specified by:
      render in class Component
      Parameters:
      engine - the base engine, which runs the game
      Since:
      0.4.0
    • addFrame

      public void addFrame(javafx.scene.image.Image frame)

      Adding a frame to the animation

      Parameters:
      frame - the frame to be added
      Since:
      0.4.0
    • removeFrame

      public void removeFrame(javafx.scene.image.Image frame)

      Removing a frame from the animation

      Parameters:
      frame - the frame to be removed
      Since:
      0.4.0
    • addFrames

      public void addFrames(javafx.scene.image.Image[] frames)

      Adding multiple frames to the animation

      Parameters:
      frames - the frames to be added
      Since:
      0.4.0
    • removeFrames

      public void removeFrames(javafx.scene.image.Image[] frames)

      Removing multiple frames from the animation

      Parameters:
      frames - the frames to be removed
      Since:
      0.4.0
    • getFrameCount

      public int getFrameCount()

      Getting how many frames are present in the animation

      Since:
      0.4.0
    • getFrames

      public List<javafx.scene.image.Image> getFrames()

      Getting the frames present in the animation

      Since:
      0.4.0
    • setFrames

      public void setFrames(List<javafx.scene.image.Image> frames)

      Setting the frames present in the animation

      Since:
      0.4.0
    • setFrames

      public void setFrames(javafx.scene.image.Image[] frames)

      Setting the frames present in the animation

      Since:
      0.4.0