I tried to make a constructor in a Superclass but it outputs the system.out.print i put in it but won't create the new object in the World
World code:
and the code in the Superclass
Anyone have any ideas on how to solve it that i will get the object (including the image) on the world at that location
public game1()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(900,900, 1);
prepare();
}
/**
* Prepare the world for the start of the program. That is: create the initial
* objects and add them to the world.
*/
private void prepare()
{
MainBoat b1 = new MainBoat();
addObject(b1, 300, 57);
MainBoat b2 = new MainBoat(20,20);
addObject(b2, 60, 300);
MainBoat b3 = new MainBoat(220,20);
addObject(b3, 60, 300);
} public MainBoat() {
size = 10;
setImage("images/Boatbig.png");
System.out.println("1");
}
public MainBoat(int newSize, int loadtime) {
size = newSize;
loadingTime = loadtime;
if (size == 20){
setImage("images/Boatmedium.png");
System.out.println("2");
}
else {
setImage("images/Boatsmall.png");
System.out.println("3");
}
}
