My actor hits an object and some other objects (the enemies) are removed caused by that inicident.
My objects are gone now, but I need them to be added to my score Counter
How I add some points to the score (from another class, this is only an example):
public void zaubern()
{
if (isTouching(Elderstab.class)) {
removeTouching(Elderstab.class);
Dementor dementor = new Dementor();
getWorld().removeObjects(getWorld().getObjects(Dementor.class))
};public class Counter extends Actor
{
int newScore = 0;
public void act()
{
setImage(new GreenfootImage("Score: " + newScore, 25, Color.WHITE, Color.BLACK));
}
public void addScore()
{
newScore++;
} World myWorld = getWorld();
Hogwarts hogwarts = (Hogwarts)myWorld;
Counter counter = hogwarts.getCounter();
counter.addScore();
