|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectandroid.gameengine.icadroids.objects.graphics.Sprite
android.gameengine.icadroids.objects.graphics.AnimatedSprite
public class AnimatedSprite
AnimatedSprite is the same as sprite, but has some extra animation functionalities in it. An animatedsprite is a film strip of pictures that will be played after each other. To start animating a sprite, call 'startAnimate()'
Field Summary |
---|
Fields inherited from class android.gameengine.icadroids.objects.graphics.Sprite |
---|
loadDelayedSprites, spriteBitmap, spriteHeight, spriteWidth |
Constructor Summary | |
---|---|
AnimatedSprite()
Make an AnimatedSprite without loading any bitmap in it |
|
AnimatedSprite(java.lang.String resourceName,
int numberOfFrames)
Create an Animated sprite using the specified image and having the specified number of frames. |
Method Summary | |
---|---|
int |
getAnimationSpeed()
Get the animation speed |
int |
getCurrentFrameNumber()
Get the current frame number of the animation |
Rect |
getCurrentFrameRectangle()
Get the current frame size as rectangle |
int |
getFrameWidth()
Get the frame width of this AnimatedSprite |
int |
getNumberOfFrames()
Get the number of frames of the sprite |
float |
getSpriteCenterX()
Get the middle of the frame, horizontally |
float |
getSpriteCenterY()
Get the middle of the frame, vertically |
void |
initialize()
Initialize the sprite image. |
void |
loadAnimatedSprite(java.lang.String resourceName,
int numberOfFrames)
Load a sprite with the given resource. |
void |
nextFrame()
Go to the next frame of the animation By default this method will make your animated sprite cycle through all frames. |
void |
previousFrame()
Go to the previous frame of the animation |
void |
setAnimationSpeed(int animationSpeed)
Set the speed of the animation |
void |
setFrameNumber(int frameNumber)
Set the frame number of the animation |
void |
startAnimate()
Start animating the sprite |
void |
stopAnimate()
Stop animating the sprite |
void |
updateToNextFrame()
Method that needs to be called every update of the gameloop. |
Methods inherited from class android.gameengine.icadroids.objects.graphics.Sprite |
---|
calculateSize, getFrameHeight, getSprite, loadSprite, setSprite |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AnimatedSprite()
public AnimatedSprite(java.lang.String resourceName, int numberOfFrames)
resourceName
- The name of the resource in the /res/drawable folder
without extension , so when your picture in the
/res/drawable is named 'picture.jpg', this parameter should be
"picture" .numberOfFrames
- The number of frames in the stripMethod Detail |
---|
public final void loadAnimatedSprite(java.lang.String resourceName, int numberOfFrames)
resourceName
- The name of the resource in the /res/drawable folder
without extension , so when your picture in the
/res/drawable is named 'picture.jpg', this parameter should be
"picture" .numberOfFrames
- The number of frames in the stripSprite.loadSprite(java.lang.String)
public void initialize()
initialize
in class Sprite
public final void updateToNextFrame()
public final void nextFrame()
public final void previousFrame()
public final void stopAnimate()
public final void setFrameNumber(int frameNumber)
frameNumber
- The frame number to jump topublic final int getCurrentFrameNumber()
public final Rect getCurrentFrameRectangle()
public final void startAnimate()
public final void setAnimationSpeed(int animationSpeed)
animationSpeed
- How many update must occur before going to the next frame. So
when animationSpeed is 3, it takes 3 updates to go to the next
frame.public int getAnimationSpeed()
public final int getFrameWidth()
getFrameWidth
in class Sprite
Sprite.getFrameWidth()
public int getNumberOfFrames()
public final float getSpriteCenterX()
getSpriteCenterX
in class Sprite
Sprite.getSpriteCenterX()
public final float getSpriteCenterY()
getSpriteCenterY
in class Sprite
Sprite.getSpriteCenterY()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |