Class StateHelper<M extends EntityModelHelper>

    • Field Detail

      • animation

        protected final Animation animation
        State animation data.
      • transformable

        protected final Transformable transformable
        Transformable reference.
      • mirrorable

        protected final Mirrorable mirrorable
        Mirrorable reference.
      • rasterable

        protected final Rasterable rasterable
        Rasterable reference.
      • body

        protected final Body body
        Body reference.
      • animatable

        protected final Animatable animatable
        Animator reference.
      • tileCollidable

        protected final TileCollidable tileCollidable
        Tile collidable reference.
      • collidable

        protected final Collidable collidable
        Collidable reference.
    • Constructor Detail

      • StateHelper

        protected StateHelper​(M model,
                              Animation animation)
        Create the state.
        Parameters:
        model - The model reference.
        animation - The animation reference.
    • Method Detail

      • onCollided

        protected void onCollided​(CollisionResult result,
                                  CollisionCategory category)
        Called on collided.
        Parameters:
        result - The collided tile.
        category - The collided axis.
      • mirrorHorizontal

        protected void mirrorHorizontal()
        Perform horizontal mirroring.
      • updateMirrorHorizontal

        protected void updateMirrorHorizontal()
        Update mirror on horizontal axis (perform mirror when going on the opposite side).
      • updateMirrorVertical

        protected void updateMirrorVertical()
        Update mirror on vertical axis (perform mirror when going on the opposite side).
      • is

        protected final boolean is​(AnimState state)
        Check if is anim state.
        Parameters:
        state - The expected anim state.
        Returns:
        true if is state, false else.
      • is

        protected final boolean is​(Mirror mirror)
        Check if is current mirror state.
        Parameters:
        mirror - The expected mirror to be.
        Returns:
        true if is mirror, false else.
      • isGo

        protected final boolean isGo()
        Check if going somewhere.
        Returns:
        true if not going to move, false else.
      • isGoNone

        protected final boolean isGoNone()
        Check if going nowhere.
        Returns:
        true if not going to move, false else.
      • isGoHorizontal

        protected final boolean isGoHorizontal()
        Check if going horizontally in any way.
        Returns:
        true if going to left or right, false else.
      • isGoLeft

        protected final boolean isGoLeft()
        Check if going left.
        Returns:
        true if going to left, false else.
      • isGoRight

        protected final boolean isGoRight()
        Check if going right.
        Returns:
        true if going to right, false else.
      • isGoVertical

        protected final boolean isGoVertical()
        Check if going vertically in any way.
        Returns:
        true if going to up or down, false else.
      • isGoUp

        protected final boolean isGoUp()
        Check if going up.
        Returns:
        true if going to up, false else.
      • isGoDown

        protected final boolean isGoDown()
        Check if going down.
        Returns:
        true if going to down, false else.
      • isGoUpOnce

        protected final boolean isGoUpOnce()
        Check if going up one time.
        Returns:
        true if going to up, false else.
      • isGoDownOnce

        protected final boolean isGoDownOnce()
        Check if going down one time.
        Returns:
        true if going to down, false else.
      • isGoLeftOnce

        protected final boolean isGoLeftOnce()
        Check if going left once.
        Returns:
        true if going to left, false else.
      • isGoRightOnce

        protected final boolean isGoRightOnce()
        Check if going right once.
        Returns:
        true if going to right, false else.
      • isFire

        protected final boolean isFire​(java.lang.Integer index)
        Check if fire button is enabled.
        Parameters:
        index - The button index (must not be null, must be positive).
        Returns:
        true if active, false else.
      • isFireOnce

        protected final boolean isFireOnce​(java.lang.Integer index)
        Check if fire button is enabled once.
        Parameters:
        index - The button index (must not be null, must be positive).
        Returns:
        true if active, false else.
      • isChangingDirectionHorizontal

        protected final boolean isChangingDirectionHorizontal​(Force force)
        Check if checking horizontal direction side.
        Parameters:
        force - The force reference.
        Returns:
        true if going to the opposite, false else.
      • isCollideX

        protected final boolean isCollideX()
        Check if horizontal collide.
        Returns:
        true if horizontal collide, false else.
      • isCollideY

        protected final boolean isCollideY()
        Check if vertical collide.
        Returns:
        true if vertical collide, false else.
      • enter

        public void enter()
        Specified by:
        enter in interface State
      • update

        public void update​(double extrp)
        Specified by:
        update in interface Updatable