The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.
public class GameScreen extends GameCanvas implements Runnable, CommandListener {
.
. (yada, yada, yada)
.
private PlayerLifeSprite playerLifeSprite[]; // array of classes
.
.
}
public GameScreen(JavaTron midlet,Settings settings,Score score) throws Exception {
super(true);
this.midlet = midlet;
.
.
.
for (int i = 0 ; i < IMAXNUMPLAYERLIVERS ; i++){
playerLifeSprite[i] = new PlayerLifeSprite( playerLifeImage,
PLAYERLIFEWIDTH,
PLAYERLIFEHEIGHT);
}
.
.
.
}
And I'm getting a java.lang.NullPointerException when I run the emulator. Any suggestions?
> Might be a while yet, and it's specifically for the Motorola V300 /
> V500 / V600 series or phones, still, I'll bung it somewhere ;)
I've been wanting to try developing something for mobiles for a while now... I just never seem to get around it it, I've either still got to finish off Applets, or some idot hires me (either that or I'm just too lazy)
Mind if I pick your brains when I finally do get around to it?
> I need to use sprites for score and lives display now, as its just
> crippled (as I expected) my framerate. Damn.
Are you writing it for commercial release, or just to see if you can?
> Any chance of posting a link to the game when your done?
Might be a while yet, and it's specifically for the Motorola V300 / V500 / V600 series or phones, still, I'll bung it somewhere ;)
I need to use sprites for score and lives display now, as its just crippled (as I expected) my framerate. Damn.
> Hugo, don't bother. Sorted.
lol... no worries man ;)
Any chance of posting a link to the game when your done?
PlayerLifeSprite[] playerLifeSprite = new PlayerLifeSprite[MAXNUMPLAYERLIVES];
for (int i = 0 ; i < MAXNUMPLAYERLIVES ; i++){
playerLifeSprite[i] = new PlayerLifeSprite( playerLifeImage, PLAYERLIFEWIDTH, PLAYERLIFEHEIGHT);
}
I didn't initialise the array (grumble, whine, I much prefer C++)
> private PlayerLifeSprite playerLifeSprite[IMAXNUMPLAYERLIVERS]; //
> array of classes
No, fist thing I tried. Giving a size to the array returns a "]" expected on compilation.
Private static final PlayerLifeSprite playerLifeSprite[IMAXNUMPLAYERLIVERS]; //
also throws an error. >:(
Could it be that your array isn't being initiated with IMAXNUMPLAYERLIVERS elements in it?
Should
private PlayerLifeSprite playerLifeSprite[]; // array of classes
be
private PlayerLifeSprite playerLifeSprite[IMAXNUMPLAYERLIVERS]; // array of classes
public class GameScreen extends GameCanvas implements Runnable, CommandListener {
.
. (yada, yada, yada)
.
private PlayerLifeSprite playerLifeSprite[]; // array of classes
.
.
}
public GameScreen(JavaTron midlet,Settings settings,Score score) throws Exception {
super(true);
this.midlet = midlet;
.
.
.
for (int i = 0 ; i < IMAXNUMPLAYERLIVERS ; i++){
playerLifeSprite[i] = new PlayerLifeSprite( playerLifeImage,
PLAYERLIFEWIDTH,
PLAYERLIFEHEIGHT);
}
.
.
.
}
And I'm getting a java.lang.NullPointerException when I run the emulator. Any suggestions?