Sprite Methods - Motorola C370 Series Technical Manual

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

Advertisement

8
Gaming API and Sound
The creation of the raw frames follows these standards:
The frames in the source image will have raw frame numbers as follows:
(M – 1) * N
So the total number of frames is M * N, where:
At the time of creation, all Sprites have a default frame sequence corresponding to
the raw frame numbers. This can be modified with setFrameSequence(). At
construction time, the Sprite's position will be set 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(Sprite s) – Creates a new Sprite from another
Create a copy of a
current frame, visibility) of the source
Sprite
second Sprite should not be reflected in the second Sprite.

Sprite Methods

The
Sprite
public void setPosition(int x, int y) – Set Sprite's x,y
position. The x, y position is relative to whatever object the sprite is associated with or
drawn on.
Frames must be equally sized, all being of the frame width (
(
) defined in the constructor parameters. They may be laid out in the
fHeight
image horizontally, vertically, or as a grid. The width of the source image must be
an integer multiple of the frame width. The height of the source image must be
an integer multiple of the frame height.
The frames are numbered like words are read on a page; left-to-right, then top-
to-bottom. The top-left frame is numbered 0. If there is a frame to its right, this
frame is numbered 1, and so on, across the first row of frames. If there is a
second row of frames, the number of the left-most frame in this row is one
greater than the right-most frame in the preceding row. The table below is a
diagrammatic depiction:
0
N
2N
. . .
((M-1)* N ) + 1
N = (image width) / (frame width)
M = (image height) / (frame height)
. All attributes (raw frames, position, frame sequence,
Sprite
. Any subsequent updates to the source
class implements the following methods:
1
. . .
N + 1
. . .
2N + 1
. . .
. . .
. . .
. . .
should be reflected in the new
Sprite
Sprite
) and height
fWidth
N – 1
2N – 1
. . .
(M * N ) – 1
Sprite
after the creation of the
57
.

Advertisement

Table of Contents
loading

This manual is also suitable for:

C450 seriesC550 series

Table of Contents