Class GlidingSprite
java.lang.Object
com.badlogic.gdx.graphics.g2d.TextureRegion
com.github.yellowstonegames.smooth.ParentSprite
com.github.yellowstonegames.smooth.GlidingSprite
Extends
Sprite, using a normal TextureRegion its visuals and a CoordGlider to store its
position. The CoordGlider is publicly available as location or with getLocation(), which
should be used to determine or change where this started its move, where it is going, and how far it has gone between
the two. You probably want to use a Texture with a width and height of 1 world unit, because by default this calls
setSize(1, 1); in its constructor; this avoids the need to convert between Coord units in the CoordGlider and
some other unit in the world.-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal VectorSequenceGliderA VectorSequenceGlider that is empty (has no motions) and belongs to this AnimatedGlidingSprite. -
Constructor Summary
ConstructorsConstructorDescriptionGlidingSprite(com.badlogic.gdx.graphics.g2d.TextureRegion region) GlidingSprite(com.badlogic.gdx.graphics.g2d.TextureRegion region, com.github.yellowstonegames.grid.Coord coord) GlidingSprite(com.badlogic.gdx.graphics.g2d.TextureRegion region, com.github.yellowstonegames.grid.Coord start, com.github.yellowstonegames.grid.Coord end) -
Method Summary
Modifier and TypeMethodDescriptionfloat[]Returns the packed vertices, colors, and texture coordinates for this sprite.floatgetX()floatgetY()voidsetLocation(CoordGlider location) voidsetSmallMotion(VectorSequenceGlider smallMotion) Methods inherited from class ParentSprite
draw, draw, flip, getBoundingRectangle, getColor, getHeight, getOriginX, getOriginY, getRotation, getScaleX, getScaleY, getWidth, rotate, rotate90, scale, scroll, set, setAlpha, setBounds, setCenter, setCenterX, setCenterY, setColor, setColor, setFlip, setOrigin, setOriginBasedPosition, setOriginCenter, setPackedColor, setPosition, setRegion, setRotation, setScale, setScale, setSize, setU, setU2, setV, setV2, setX, setY, translate, translateX, translateYMethods inherited from class com.badlogic.gdx.graphics.g2d.TextureRegion
getRegionHeight, getRegionWidth, getRegionX, getRegionY, getTexture, getU, getU2, getV, getV2, isFlipX, isFlipY, setRegion, setRegion, setRegion, setRegion, setRegionHeight, setRegionWidth, setRegionX, setRegionY, setTexture, split, split
-
Field Details
-
location
-
smallMotion
-
ownEmptyMotion
A VectorSequenceGlider that is empty (has no motions) and belongs to this AnimatedGlidingSprite. This is public so external code can use it, but should never be modified. It is here sosmallMotioncan be easily set to an empty sequence. You can also usesetSmallMotion(null)to stop any small motion.
-
-
Constructor Details
-
GlidingSprite
public GlidingSprite(com.badlogic.gdx.graphics.g2d.TextureRegion region) -
GlidingSprite
public GlidingSprite(com.badlogic.gdx.graphics.g2d.TextureRegion region, com.github.yellowstonegames.grid.Coord coord) -
GlidingSprite
public GlidingSprite(com.badlogic.gdx.graphics.g2d.TextureRegion region, com.github.yellowstonegames.grid.Coord start, com.github.yellowstonegames.grid.Coord end)
-
-
Method Details
-
getX
public float getX()- Overrides:
getXin classParentSprite
-
getY
public float getY()- Overrides:
getYin classParentSprite
-
getVertices
public float[] getVertices()Description copied from class:ParentSpriteReturns the packed vertices, colors, and texture coordinates for this sprite.- Overrides:
getVerticesin classParentSprite
-
getLocation
-
setLocation
-
getSmallMotion
-
setSmallMotion
-