This site requires JavaScript, please enable it in your browser!
Greenfoot back
Projava99
Projava99 wrote ...

2021/5/28

my scoreboard doesn't appear

Projava99 Projava99

2021/5/28

#
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * the score of the game * @version 27-1-2021 */ public class Scoreboard extends Actor { public static final float FONT_SIZE = 24.0f; public static final int WIDTH = 150; public static final int HEIGHT = 50; public static final int TRANSPARENCY = 128; public static final int RED = 255; public static final int GREEN = 255; public static final int BLUE = 255; public void makeScoreboard() { GreenfootImage image = new GreenfootImage(WIDTH, HEIGHT); //create a new image with Java Color color = new Color (RED,GREEN,BLUE,TRANSPARENCY ); //create a new color image.setColor(color); //set the color of the image with the object color image.fillRect(0, 0, WIDTH, HEIGHT); //fill the rectangle with the setted color setImage(image); //create the image image.setColor(new Color(RED,0,0,TRANSPARENCY)); image.fillRect(5, 5, WIDTH-10, HEIGHT-10); } } this is my code but the only thing that pops up is a small foot. can someone please help?
danpost danpost

2021/5/28

#
Add the following to the class:
public Scoreboard()
{
    makeScoreboard();
}
This constructor will initialize the image.
You need to login to post a reply.