im trying to run this code and it keeps giving me null pointer exceptions in relation to the show text parts of it i have all my code below(there are 1 or 2 other objects reffered to but they are completly empty so theres no code to post)
WORLD CODE:
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class MyWorld here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class MyWorld extends World
{
boolean whoseturn = true;
/**
* Constructor for objects of class MyWorld.
*
*/
public MyWorld()
{
super(600, 400, 1);
}
public void act()
{
P1Charizard p1Charizard = new P1Charizard();
Actor test = new Actor;
test = new P1Charizard();
addObject(test, 160, 300);
if(whoseturn = true)
{
p1Charizard.Moveset();
}
else if(whoseturn = false)
{
}
}
}
ACTOR CODE:
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class P1Charizard here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class P1Charizard extends Actor
{
/**
* Act - do whatever the P1Charizard wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
}
public void Moveset()
{
Actor CharizardMoveset = new Actor;
CharizardMoveset = populateMoveset(CharizardMoveset);
boolean ts = true;
if(ts = true)
{
getWorld().showText("What Action Would You Like To Take",430, 280);
getWorld().showText("Attack(1)", 350, 310);
getWorld().showText("Swap Out(2)", 500, 310);
}
if(Greenfoot.isKeyDown("1"))
{
ts = false;
getWorld().showText("", 430, 280);
getWorld().showText("", 350, 310);
getWorld().showText("", 500, 310);
getWorld().showText("Which Attack Would You Like To Use",430, 280);
getWorld().showText("Flamethrower(3)", 350, 310);
getWorld().showText("Fire Blast(4)", 500, 310);
getWorld().showText("Fly(5)", 350, 360);
getWorld().showText("Dragon Claw(6)", 500, 360);
if(Greenfoot.isKeyDown("3"))
{
getWorld().addObject(CharizardMoveset, 300, 200);
Greenfoot.delay(100);
getWorld().removeObject(CharizardMoveset);
getWorld().showText("", 430, 280);
getWorld().showText("", 350, 310);
getWorld().showText("", 500, 310);
getWorld().showText("", 350, 360);
getWorld().showText("", 500, 360);
}
Greenfoot.delay(1);
}
}
public Actor populateMoveset(Actor CharizardMoveset)
{
CharizardMoveset = new Flamethrower();
return CharizardMoveset;
}
}

