I am having an issue where the code I have is saying that there is a java.lang.NullPointerExpection. Could you please help
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Turtleworld here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Turtleworld extends World
{
public int TurtlesNibbled = 0;
private Swag swag;
/**
* Constructor for objects of class Turtleworld.
*
*/
public Turtleworld()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(600, 400, 1);
populateWorld();
reLive();
}
public void reLive()
{
swag.getScore();
if (TurtlesNibbled == 1)
{
addObject(new Turtle(), 300, 200 );
}
}
public void populateWorld()
{
addObject(new Turtle(), 300, 200 );
}
}
