for gameover
import greenfoot.*; // (World, Actor, GreenfootImage, and Greenfoot)
import java.awt.Color;
import java.awt.Font;
import java.util.Calendar;
/**
* The ScoreBoard is used to display results on the screen. It can display some
* text and several numbers.
*
* @author M Kolling
* @version 1.0
*/
public class GameOver extends Actor
{
public static final float FONT_SIZE = 48.0f;
public static final int WIDTH = 400;
public static final int HEIGHT = 300;
int SCORE=0;
/**
* Create a score board with dummy result for testing.
*/
public GameOver()
{
this(100);
}
/**
* Create a score board for the final result.
*/
public GameOver(int score)
{
makeImage("Game Over", "Score: ", "Press enter", score);
SCORE=score;
}
/**
* Make the score board image.
*/
private void makeImage(String title, String prefix, String prefix2, int score)
{
GreenfootImage image = new GreenfootImage(WIDTH, HEIGHT);
image.setColor(new Color(255,255,255, 128));
image.fillRect(0, 0, WIDTH, HEIGHT);
image.setColor(new Color(0, 0, 0, 128));
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);
image.drawString(prefix + score, 60, 200);
image.drawString(prefix2, 60, 250);
setImage(image);
}
public void act()
{
if(Greenfoot.isKeyDown("enter")){
CrabWorld crabworld = (CrabWorld) getWorld();
crabworld.scoreboard(SCORE);
getWorld().removeObject(this);
}
if(Greenfoot.isKeyDown("e")){
CrabWorld crabworld = (CrabWorld) getWorld();
crabworld.scoreboard(SCORE);
getWorld().removeObject(this);
}
}
CrabWorld world = (CrabWorld) getWorld();
CrabWorld.ScoreBoard(points);
public void scoreboard(int SCORE);
ScoreBoard sb = new ScoreBoard(600, 600);
addObject(sb,getWidth()/2,getHeight() / 2);
if (Userinfo...{ // if block code//
}
}
here it says i need a return type but my return type is right here in my scoreboard. HELP