import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and
MouseInfo)
/**
* Write a description of class MyWorld here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class MyWorld extends World
{
private Counter counter;
public Counter würfelanzahl;
public int Felder;
/**
* Constructor for objects of class MyWorld.
*
*/
public MyWorld()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(900, 900, 1);
addObject(new Würfel1(), 400, 500);
addObject(new Würfel2(), 500, 500);
addObject(new Auto(), 825, 825);
addObject(new katze(), 790, 800);
würfelanzahl=new Counter("Felder: ");
addObject(würfelanzahl, 465, 550);
*getwürfelanzahl().add(100);*
Felder=0;
}
public Counter getwürfelanzahl()
{
return würfelanzahl;
}
public void addwürfelanzahl(int würfelanzahl)
{
Felder+=würfelanzahl;
}
}
Here i try to add an integer to an Counter. I dont understand why add() doesn't work. I gett the Error that it doesn't find the symbol and asks if I mean act(). The weird thing is I copied this of an other programm I wrote and there it works without a problem.