|
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objectorg.piratis.j2me.core.game.Layer
org.piratis.j2me.core.game.Sprite
Provide some basic sprite functionality: getting and setting of coordinates and dimensions, as well as simple collision detection.
| Field Summary | |
static int |
NO_FRAME
Current frame will return this if there is no animated sprite |
| Fields inherited from class org.piratis.j2me.core.game.Layer |
bbox, TOP_LEFT, visible |
| Constructor Summary | |
Sprite(Image img)
New 'static' Sprite with the given Image. |
|
Sprite(Image img,
int frameWidth,
int frameHeight)
New 'dynamic' (animtaed) Sprite with the given frames contained in the Image. |
|
| Method Summary | |
int |
getFrame()
Gets the current frame index |
void |
nextFrame()
Moves forward to the next frame in sequence Frame sequences are circular: when reached the end of the sequence, it will continue at the beginning. |
void |
paint(Graphics g)
Paints the Sprite into the Graphics object provided. |
void |
prevFrame()
Moves backward to the previous frame in sequence Frame sequences are circular: when reached the beginnig of the sequence, it will continue at the last frame. |
void |
setFrame(int newFrame)
Selectes the current frame in the current sequence. |
void |
setFrameSequence(int[] sequence)
Establish the frame sequence of the Sprite. |
| Methods inherited from class org.piratis.j2me.core.game.Layer |
getBbox, isVisible, moveBy, moveTo, setVisible |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static int NO_FRAME
| Constructor Detail |
public Sprite(Image img)
public Sprite(Image img,
int frameWidth,
int frameHeight)
Layer.getBbox()).
img - Image containing the framesframeWidth - the width of each frameframeHeight - the height of each frame| Method Detail |
public final void paint(Graphics g)
paint in class Layerg - the graphics object for rendering this layerLayer#paint(javax.microedition.lcdui.Graphics)public int getFrame()
public void setFrame(int newFrame)
throws java.lang.IndexOutOfBoundsException
newFrame - the index of the desired frame to be displayed on the next
paint call of the current sequence
java.lang.IndexOutOfBoundsException - if the index is out of the bound of the
current frame sequencepublic void nextFrame()
prevFrame()public void prevFrame()
nextFrame()public void setFrameSequence(int[] sequence)
sequence -
|
Copyright(c) 2003-2004 Jordi Martin | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||