Hi there !
this is a part of a scenario for air hockey and in this fragment:
import greenfoot.*;
import java.awt.Color;
import java.awt.Font;
public class Main_Menu extends Actor
{
private String points = "5";
private String time = "3";
private GreenfootImage img;
//syzdavane na golemi na shrifta - used defined :)
private final Font font_20 = new Font("font_20", 0, 20);
private final Font font_15 = new Font("font_15", 0, 15);
private final Font font_24 = new Font("font_24", 0, 24);
private final Font font_30 = new Font("font_30", Font.BOLD, 30);
private int timeInMinutes = 3;
private int pointsToWin = 5;
private int difficulty = 2;//1 = easy, 2 = normal, 3 = hard;
private boolean gameOnPoints = true;
private boolean changePoints = false;
private boolean changeTime = false;
public Main_Menu() {
img = getImage();
img.clear();
img.scale(450, 355);//preorazmerqvane
img.setColor(Color.black);//ramka
img.fill();
img.setColor(Color.white);
img.fillRect(10, 10, 430, 335);
img.setFont(font_30);//risuvane menu
img.setColor(Color.black);
img.drawString("Шайба", 170, 50);
img.fillRect(50, 100, 20, 20);//risuvane na checkboxovete
img.fillRect(50, 150, 20, 20);
img.setColor(Color.white);
if (gameOnPoints) {
img.fillRect(53, 153, 14, 14);
}
else {
img.fillRect(53, 103, 14, 14);
}
img.setFont(font_24);//draw the checkbox text;
img.setColor(Color.black);
img.drawString("�гра на точки", 85, 118);
img.drawString("�гра за време", 85, 168);
img.drawString("5 Точки", 280, 118);
img.drawString("3 Минути", 280, 168);
img.fillRect(60, 215, 15, 15);//checboxove trudnost
img.fillRect(185, 215, 15, 15);
img.fillRect(310, 215, 15, 15);
img.drawString("Лесно", 85, 230);
img.drawString("Средно", 210, 230);
img.drawString("РўСЂСѓРґРЅРѕ", 335, 230);
img.setColor(Color.white);
img.fillRect(63, 218, 9, 9);
img.fillRect(313, 218, 9, 9);
img.setColor(Color.black);//start buton
img.fillRect(150, 255, 150, 50);
img.setColor(Color.white);
img.fillRect(155, 260, 140, 40);
img.setColor(Color.black);
img.setFont(font_24);
img.drawString(" Започни !", 164, 289);
img.setColor(Color.black);
img.setFont(font_15);
img.drawString("Павел Кукушев 106007", 275, 335);
}
public void act() { //prihvashtane izbor ot menu-to
MouseInfo mouse = Greenfoot.getMouseInfo();
if (Greenfoot.mousePressed(null) && mouse != null) {
if (mouse.getX() > 75 && mouse.getX() < 95 && mouse.getY() > 288 && mouse.getY() < 310) {
gameOnPoints = true;
img.setColor(Color.black);
img.fillRect(50, 100, 20, 20);
img.fillRect(50, 150, 20, 20);
img.setColor(Color.white);
if (gameOnPoints) {
img.fillRect(53, 153, 14, 14);
}
else {
img.fillRect(53, 103, 14, 14);
}
}
else if (mouse.getX() > 75 && mouse.getX() < 95 && mouse.getY() > 338 && mouse.getY() < 360) {
gameOnPoints = false;
img.setColor(Color.black);
img.fillRect(50, 100, 20, 20);
img.fillRect(50, 150, 20, 20);
img.setColor(Color.white);
if (gameOnPoints) {
img.fillRect(53, 153, 14, 14);
}
else {
img.fillRect(53, 103, 14, 14);
}
}
else if (mouse.getX() > 85 && mouse.getX() < 101 && mouse.getY() > 405 && mouse.getY() < 419) {
changeDifficulty(1);
}
else if (mouse.getX() > 210 && mouse.getX() < 226 && mouse.getY() > 405 && mouse.getY() < 419) {
changeDifficulty(2);
}
else if (mouse.getX() > 335 && mouse.getX() < 351 && mouse.getY() > 405 && mouse.getY() < 419) {
changeDifficulty(3);
}
else if (mouse.getX() > 175 && mouse.getX() < 325 && mouse.getY() > 440 && mouse.getY() < 495) {
startGame();
return;
}
//System.out.println(mouse.getX() + " " + mouse.getY());
}
}
private void changeDifficulty(int difficulty) {
this.difficulty = difficulty;
img.setColor(Color.black);
img.fillRect(60, 215, 15, 15);
img.fillRect(185, 215, 15, 15);
img.fillRect(310, 215, 15, 15);
img.setColor(Color.white);
switch (difficulty) {
case 1:
img.fillRect(188, 218, 9, 9);
img.fillRect(313, 218, 9, 9);
break;
case 2:
img.fillRect(63, 218, 9, 9);
img.fillRect(313, 218, 9, 9);
break;
case 3:
img.fillRect(63, 218, 9, 9);
img.fillRect(188, 218, 9, 9);
break;
}
}
public void changeText() {
img.setColor(Color.white);
img.fillRect(270, 90, 165, 40);
img.fillRect(270, 140, 165, 40);
img.setFont(font_24);
img.setColor(Color.black);
//img.drawString((pointsToWin <= 100 ? Integer.toString(pointsToWin) : "100") + " Points", 280, 118);
//img.drawString((timeInMinutes <= 100 ? Integer.toString(timeInMinutes) : "100") + " Minutes", 280, 168);
}
private void startGame() {
submitValues();
getWorld().removeObject(this);
}
private void submitValues() {
Air_Hockey_Table.resetPlayerPoints_1();
Air_Hockey_Table.resetPlayerPoints_2();
((Air_Hockey_Table) getWorld()).submitValues(gameOnPoints, pointsToWin, timeInMinutes, difficulty);
}
}
it never removes the errors for :
import java.awt.Color;
import java.awt.Font;
//which cannot be resolved???
the vars for font //cannot be resolved as type
and all the setColor functions
this is the url for the scenario: http://www.greenfoot.org/scenarios/10243
any ideas?