Ok, here's the flowdown:
Cursor moves around for a bit, then makes a call to start a battle. It uses this code:
That makes a call to create a "Battle" object. The battle class is then called, and does this:
At which point, there is a null pointer exception where indicated above. I've been racking my brain and tracing the code, but for the life of me I can't tell why the battle class can't create this object:
Can anyone help? I'm trying to create a turn based battle system, and since no one knows how to do that, I'm on my own.
public void beginBattle()
{
getWorld().addObject(new Battle(), 349, 128);
}public class Battle extends Actor
{
private BattleBackdrop enemyField;
public Battle()
{
//Creates a battle screen and places it.
//enemyField = getWorld().addObject(new enemyField, 349, 128);
enemyField = new BattleBackdrop();
getWorld().addObject(enemyField, 349, 128); //null pointer right here.
//Calls the method setEnemies() to set enemies on the battle backdrop.
setEnemies();
}public class BattleBackdrop extends Backdrops
{
private GreenfootImage img = new GreenfootImage("Battlescreen2.png");
public BattleBackdrop()
{
setImage(img);
}
