Using Sprite; Fileformatnotsupportedexception - Motorola C370 Series Technical Manual

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

Advertisement

Using Sprite

The example below creates two Sprites (bullet and tank) and tests collisions between
them. When there are no lives left, the game finishes.
The following is a code sample to show implementation of using sprites:
Sprites
try {
Sprite bullet = new Sprite(Image.createImage("bullet.png");
Sprite tank = new Sprite(Image.createImage("tank.png");
} catch (Exception e) {
// any image can't be loaded
}
Boolean isGameOver= False;
int lifes= 3; // The number of lives is 3
while(!isGameOver) {
// verifies the collision between the two sprites
if(tank.collidesWith(bullet,false)) {
lifes--;
// If there are no more lifes, the game is over
if(lifes == -1) {
isGameOver = true;
}
}
}

FileFormatNotSupportedException

The
FileFormatNotSupportedException
when a
or the size of the data is larger than the size of the internal buffers. The
FileFormatNotSupportedException
java.lang.RuntimeException
Any custom frame sequence will be deleted and the frame sequence will revert
to the default frame sequence for the new frame set (all frames in the frame set,
left-to-right then top-to-bottom).
or
SoundEffect
BackgroundMusic
is an exception which will be thrown
format is not supported by the platform
extends the
class.

Advertisement

Table of Contents
loading

This manual is also suitable for:

C450 seriesC550 series

Table of Contents