public interface SpriteAnimated extends Sprite, SurfaceTile, Animator
SpriteAnimated is an extended sprite that allows to play it using Animation
. It
works like a sprite excepted that it renders only a part of it (current Animator
frame).
Animation
contains the first/last frame and the animation speed, considering the
main first frame is on the top-left sprite surface, and the last frame is on the down-right sprite surface, reading
it from left to right.
The first frame number is Animation.MINIMUM_FRAME
.
Example:
// Load final SpriteAnimated animation = Drawable.loadSpriteAnimated(Medias.create("animation.png"), 7, 1); animation.load(false); final Animation anim = new Animation(4, 6, 0.125, false, true); animation.play(anim); animation.setPosition(160, 300); // Update animation.update(extrp); // Render animation.render(g);
Modifier and Type | Method and Description |
---|---|
int |
getFrameOffsetX()
Get the horizontal frame offset.
|
int |
getFrameOffsetY()
Get the vertical frame offset.
|
int |
getFramesHorizontal()
Get the number of horizontal frames.
|
int |
getFramesVertical()
Get the number of vertical frames.
|
void |
setFrameOffsets(int offsetX,
int offsetY)
Set frame offsets (offsets on rendering).
|
filter, getMirror, rotate, setAlpha, setFade, setMirror, setTransparency, stretch
getSurface, load, prepare, setLocation, setLocation, setOrigin
getX, getY
render
getTileHeight, getTileWidth
getAnimState, getFrame, getFrameAnim, play, setAnimSpeed, setFrame, stop
void setFrameOffsets(int offsetX, int offsetY)
offsetX
- The horizontal offset.offsetY
- The vertical offset.int getFramesHorizontal()
int getFramesVertical()
int getFrameOffsetX()
int getFrameOffsetY()
Copyright © 2017 Byron 3D Games Studio. All rights reserved.