Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## superwaba.ext.xplat.game
Class AnimatedSprite

    java.lang.Object
      |
      +--superwaba.ext.xplat.game.Sprite
            |
            +--superwaba.ext.xplat.game.AnimatedSprite

public class AnimatedSprite
extends Sprite

Class implementing a game animated sprite.

     This is a sprite that supports multiple images corresponding to a sprite animation
     or sprite's different states.

See Also:
  `Sprite`

Field Summary
`protected Image[]` | `frames` Different sprite's frames.
`protected int[]` | `halfHeights` Images half width/height dimensions.
`protected int[]` | `halfWidths` Images half width/height dimensions.
`int[]` | `heights` Images width/height dimensions.
`int[]` | `widths` Images width/height dimensions.

Fields inherited from class superwaba.ext.xplat.game.Sprite
`background, bgGfx, bgX, bgY, centerX, centerY, doClip, drawOp, gfx, halfHeight, halfWidth, height, image, INVALID, regionMaxx, regionMaxy, regionMinx, regionMiny, screenErased, speed, surface, transColor, width`

Constructor Summary
`protected` | `AnimatedSprite(Image[] frames, Color transColor, boolean saveBckgd, Rect region)` AnimatedSprite constructor.

Method Summary
`void` | `setFrame(int frame)` Set the sprite's current frame.

Methods inherited from class superwaba.ext.xplat.game.Sprite
`collide, getPos, getRegion, hide, onPositionChange, setPos, setRegion, show, towardPos`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, toString, wait, wait`

Field Detail

### widths

    public int[] widths

  Images width/height dimensions. READ-ONLY attributes.

### heights

    public int[] heights

  Images width/height dimensions. READ-ONLY attributes.

### halfWidths

    protected int[] halfWidths

  Images half width/height dimensions. READ-ONLY attributes.

### halfHeights

    protected int[] halfHeights

  Images half width/height dimensions. READ-ONLY attributes.

### frames

    protected Image[] frames

  Different sprite's frames.

Constructor Detail

### AnimatedSprite

    protected AnimatedSprite(Image[] frames,
                             Color transColor,
                             boolean saveBckgd,
                             Rect region)

  AnimatedSprite constructor.
  Parameters:
    `frames` - sprite different state images.
    `transColor` - sprite's transparency color or null if none
    (needed in DRAW_SPRITE mode to keep the current background).
    `saveBckgd` - true if the background should be saved each time the sprite is drawn to restore it once the sprite moves.
    `region` - defines the sprite valid area.
    If null, a default region is set to prevent the largest sprite frame to leave even partially the screen.

Method Detail

### setFrame

    public void setFrame(int frame)

  Set the sprite's current frame.
  Parameters:
    `frame` - number to use for next sprite processing

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD