Hi, I need help. I am trying to create a deck image which contains all the cards of the deck. My cards name are an arrays of Strings which name is imageCards and are in the deck class. I have the world that create the deck. My problem is that the world doesn't create the deck. I don't know if i have explained well, so please tell me.
ERROR MESSAGE: java.lang.NullPointerException
DECK CLASS
CARD CLASS
WORLD
public Mundo()
{
super(1000, 600, 1);
this.addObject(new Deck(),100,300);
}
public Deck() { World world= getWorld(); Card deck[] = new Card[40]; int x = 0; for (int i=0;i<=deck.length;i++){ deck[i] = new Card(imageCards[i]); world.addObject(deck[i],100+x,300); x = x + 6; } }
public Card(String i) { this.image= new GreenfootImage(i); }