Animation Frames; Sprite Drawing; Sprite Constructor - Motorola C370 Series Technical Manual

J2me developer guide
Hide thumbs Also See for C370 Series:
Table of Contents

Advertisement

Animation Frames

An animated
constructor Sprite(Image, int, int). The individual sections of the image are considered the
raw frames of the
frames.

Sprite Drawing

Sprites
will be drawn on the
maintained by the Sprite (i.e. position, frame, visibility). Some potential uses of Sprites
include:
Arbitrarily draw the Sprite on a
A Sprite can be added to a
automatically draw all the Sprites associated with the
draw(Graphics) could be called from the
Canvas
draw(Graphics) could be called at any time to draw the
image. This is virtually identical to the first bullet, drawing on a
Only in the case where a set of Sprites are a part of a container object (i.e. where the
Sprite
handled by the system. In other situations, managing the drawing order is the
responsibility of the developer.

Sprite Constructor

The
Sprite
public Sprite(Image img) – Creates a new non-animated
from an
if there is a single raw frame. At construction time, the
to (0,0), the depth will be set to 0, and the Sprite will be visible. The Sprite shall
behave as if the image used in creation were cached. If a mutable image is used to
create the Sprite, the Sprite's appearance should not reflect changes to mutable
source image.
public Sprite(Image img, int fWidth, int fHeight) –
Creates a new animated
the following:
is created from an image divided into sections as described in the
sprite
. The method getNumRawFrames returns the number of raw
Sprite
can be drawn at anytime using the draw(Graphics) method. The sprite
object, according to the current state information
Graphics
PlayField
.
is associated with a
PlayField
class defines the following constructors:
object. All animation operations on a non-animated Sprite behave as
Image
Sprite
img - Image to use for Sprite;
fWidth - width, in pixels, of the individual raw frames;
fHeight - height, in pixels, of the individual raw frames.
.
GameScreen
. Then PlayField.draw(Graphics, int, int) will
PlayField
method in a subclass of
paint()
Sprite
) is the depth information automatically
Sprite's
from an Image. The constructor parameters are
.
on a MIDP mutable
.
GameScreen
Sprite
position will be set

Advertisement

Table of Contents
loading

This manual is also suitable for:

C450 seriesC550 series

Table of Contents