j2me sprite array
- by danis
I`ve tried to put the same Image into an array (array contains 22 Images) to form inventory.
for(int i=0;i>22;i++){
invSprite[i] = new Sprite(ingame);
invSprite[i].defineReferencePixel(0,0);
}
and
if(inventory){
for(int i=0;i>22;i++){
if(i>=11){
invSprite[i].setRefPixelPosition(0+15*i, 27);
}else{
invSprite[i].setRefPixelPosition(0+15*i, 42);
}
invSprite[i].paint(g);
}
}
If the inventory is on it will show those Images but it`s not.
PS if I would try
invSprite[0].setRefPixelPosition(10, 27);
invSprite[0].paint(g);
it would throw an java/lang/NullPointerException