|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.microedition.lcdui.game.Layer | +--javax.microedition.lcdui.game.Sprite | +--mgdk.MSprite
Extends Sprite, adding easier creation and better control over animation. Use new functions to create animations and activate one of them, after that you use Sprite functions to control it. Todo: Add delay in animations. Add individual delay to frames in animation. Add animation behavior (loop, bounce, hide?) Add animation ranges (startframe, endframe)
Sprite
Field Summary | |
int |
vx
Velocity x. |
int |
vy
Velocity y. |
Fields inherited from class javax.microedition.lcdui.game.Sprite |
TRANS_MIRROR, TRANS_MIRROR_ROT180, TRANS_MIRROR_ROT270, TRANS_MIRROR_ROT90, TRANS_NONE, TRANS_ROT180, TRANS_ROT270, TRANS_ROT90 |
Constructor Summary | |
MSprite(MSprite sprite)
Creates this sprite as a copy of another MSprite. |
|
MSprite(java.lang.String filename,
int frameWidth,
int frameHeight)
Creates a sprite based on an image loaded from the specified filename. |
Method Summary | |
void |
activateAnimset(int num)
Activates one of the sprites animationssets. |
void |
createAnimsets(int num)
Creates the specified (num)ber of animation sets. |
MCollisionInfo |
detailedCollidesWith(MMap map,
boolean pixel)
Checks for collisions between the sprite and a map and gives detailed information about it. |
int |
getAnimsetNum()
Returns the number of the active animset. |
void |
move()
Moves the sprite using its velocity. |
void |
nextFrame()
|
void |
setAnimDelay(int num,
int[] delays)
|
void |
setAnimset(int num,
int[] sequence)
Sets the framesequence of a animationset. |
void |
setVelocity(int vx,
int vy)
Set sprites velocity (speed & direction). |
void |
setX(int x)
Conveniencemethod for changing a sprites horizontal position. |
void |
setY(int y)
Conveniencemethod for changing a sprites vertical position. |
Methods inherited from class javax.microedition.lcdui.game.Sprite |
collidesWith, collidesWith, collidesWith, defineCollisionRectangle, defineReferencePixel, getFrame, getFrameSequenceLength, getRawFrameCount, getRefPixelX, getRefPixelY, paint, prevFrame, setFrame, setFrameSequence, setImage, setRefPixelPosition, setTransform |
Methods inherited from class javax.microedition.lcdui.game.Layer |
getHeight, getWidth, getX, getY, isVisible, move, setPosition, setVisible |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public int vx
public int vy
Constructor Detail |
public MSprite(MSprite sprite)
sprite
- Sprite to clone.public MSprite(java.lang.String filename, int frameWidth, int frameHeight)
Method Detail |
public void createAnimsets(int num)
num
- number of animationsets to use.public void setAnimset(int num, int[] sequence)
num
- The number of the animset to set (change).sequence
- Framesequence to be stored.public void setAnimDelay(int num, int[] delays)
public void activateAnimset(int num)
num
- The number of the animset to activate.public int getAnimsetNum()
public void nextFrame()
nextFrame
in class javax.microedition.lcdui.game.Sprite
public void setVelocity(int vx, int vy)
vx
- horizontal velocity .vy
- vertical velocity.public void move()
public void setX(int x)
x
- New x coordinate.public void setY(int y)
y
- New y coordinate.public MCollisionInfo detailedCollidesWith(MMap map, boolean pixel)
map
- The map which contains tiles that the sprite might collide with.MCollisionInfo
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |