Can't get my code to work.
Error: Constructor ScoreBoard in class ScoreBoard cannot be applied to given types;
required: no arguments; found: int; reason:actual and formal arguments lists differ in length
This is in my WombatWorld Class. If I remove the score and leave it "addObject(new ScoreBoard(),6,3);", it compiles but it doesn't return a score and doesn't say that the game is over.
ScoreBoard class shown below
I've declared score in my Leaf class as int score=0;
Can anybody help me please?
public void gameOver(int score) { addObject(new ScoreBoard(score),6,3); Greenfoot.stop(); }
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) import java.awt.Color; import java.awt.Font; import java.util.Calendar; /** * Write a description of class ScoreBoard here. * * @author (your name) * @version (a version number or a date) */ public class ScoreBoard extends Actor { public static final float FONT_SIZE = 48.0f; public static final int WIDTH = 400; public static final int HEIGHT = 300; public ScoreBoard() { makeImage("Game Over"); } private void makeImage(String title) { GreenfootImage image = new GreenfootImage(WIDTH, HEIGHT); image.setColor(new Color(0,0,0,160)); image.fillRect(0,0, WIDTH, HEIGHT); image.setColor(new Color(255,255,255,100)); image.fillRect(5,5, WIDTH-10,HEIGHT-10); Font font = image.getFont(); font=font.deriveFont(FONT_SIZE); image.setFont(font); image.setColor(Color.WHITE); image.drawString(title,60,100); setImage(image); } }