the error is 'constructor Ship in class Ship cannot be applied to given types;
required Bar; found:no argument; reason:actual and formal argument lists differ in length'
Would be great if someone could help
Here's my space code
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.Color;
import java.awt.Font;
/**
* Write a description of class Space here.
*
*/
public class Space extends World
{
private int countDown = 0;
Counter counter = new Counter();
public Bar bar = new Bar("YourShip", "Health Points", 10, 10);
public void act()
{
if (Greenfoot.getRandomNumber(1000) < 1) {
addObject(new Miniship(), 0, 0);
}
if (Greenfoot.getRandomNumber(1000) < 1) {
addObject(new Miniship(), 1000, 1000);
}
if (Greenfoot.getRandomNumber(1000) < 1) {
addObject(new Miniship(), 1000, 0);
}
if (Greenfoot.getRandomNumber(1000) < 1) {
addObject(new Miniship(), 0, 1000);
}
if (Greenfoot.getRandomNumber(5000) < 1) {
addObject(new Warship(), 0, 20);
}
if (Greenfoot.getRandomNumber(5000) < 1) {
addObject(new Warship(), 1000, 1000);
}
if(countDown <= 0) {
addObject( new BigRock(), getRandomX(), getRandomY() );
int rng = Greenfoot.getRandomNumber(350) + 200;
countDown = rng;
}
else {
countDown--;
}
}
public Counter getCounter()
{
return counter;
}
/**
* Random number based on width
*/
public int getRandomX() {
return Greenfoot.getRandomNumber(getWidth());
}
/**
* Random number based on height
*/
public int getRandomY() {
return Greenfoot.getRandomNumber(getHeight());
}
/**
* Constructor for objects of class Space.
*
*/
public Space()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(600, 600, 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()
{
addObject(counter, 100, 40);
Ship ship = new Ship();
addObject(ship, 303, 330);
addObject(bar, 136, 377);
Exit exit = new Exit();
addObject(exit, 537, 50);
}
}
