for reference, the world constructs if i have this radar class (ignore the class name):
What code in the previous radar class is causing the world not to construct and how do I fix that? Please help ASAP!
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 MyRadar extends World
{
private Destroyer destroyer = new Destroyer();
private Cruiser cruiser = new Cruiser();
private Battleship battleship = new Battleship();
private Carrier carrier = new Carrier();
private Submarine sub = new Submarine();
private Button v = new Button (" [Switch to other world] ");
private Cell [][] cellArray = new Cell [10][10];
private Cell cell = new Cell(cruiser, destroyer, sub, carrier, battleship);
/**
* Constructor for objects of class MyWorld.
*
*/
public MyRadar()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(1000, 600, 1);
addObject(v, 800, 50);
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 10; j++)
{
cellArray[i][j] = new Cell(cruiser, destroyer, sub, carrier, battleship);
addObject(cellArray[i][j], cellArray[i][j].getXCoordinate(j), cellArray[i][j].getYCoordinate(i));
}
}
}
public void act()
{
if (Greenfoot.mouseClicked(v))
{
Greenfoot.setWorld(Start.ships);
}
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 10; j++)
{
cellArray[i][j].change();
cellArray[i][j].isHit();
}
}
}
}
