Hi, for my world currently, I am trying to add a life counter in that decreases whenever the enemy touches the player (Karmen), however there is this error that shows up as "cannot find symbol - method karmenLifeCount()" although I had put it in there ?
This is my world code
and this is the code for the enemy
public class Level_1 extends World
{
private int score = 0;
public static Counter karmenLifeCount = new Counter();
/**
* Constructor for objects of class Level_1.
*
*/
public Level_1()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(800, 600, 1);
karmenLifeCount.setValue(3);
addObject(karmenLifeCount(), 410, 15);
prepare();
}
private void prepare()
{
Level_1_Floor level_1_floor = new Level_1_Floor();
addObject(level_1_floor, 399, 299);
Karmen karmen = new Karmen();
addObject(karmen, 100, 533);
Yoichi yoichi = new Yoichi();
addObject(yoichi, 140, 538);
Platform platform = new Platform(150, 80);
addObject(platform, 353, 469);
Platform_2 platform_2 = new Platform_2();
addObject(platform_2, 615, 379);
addObject(new Platform (150, 80), 453, 278);
KarmenGem karmengem = new KarmenGem();
addObject(karmengem, 349, 423);
EndIsland endisland = new EndIsland(250, 80);
addObject(endisland, 155, 116);
EndPortal endportal = new EndPortal(150, 80);
addObject(endportal, 151, 51);
ThirdIsland thirdisland = new ThirdIsland();
addObject(thirdisland, 309, 199);
YoichiGem yoichigem = new YoichiGem(60,40);
addObject(yoichigem, 610, 335);
Enemy1 enemy1 = new Enemy1();
addObject(enemy1, 289, 329);
addObject(new Enemy1(), 578, 169);
Pause pause = new Pause();
addObject(pause,764, 34);
addObject(new Level1Music(), 758, 560);
}
}
public class Enemy1 extends Enemies
{
int rightSideOfScreen;
int bottomOfScreen;
public void addedToWorld(World level1)
{
rightSideOfScreen = level1.getWidth() - 1;
bottomOfScreen = level1.getHeight() - 1;
}
/**
* Act - do whatever the Enemy1 wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
move(5);
moveAround();
Karmen k =(Karmen) getOneIntersectingObject(Karmen.class);
if(k !=null)
{
Level_1.karmenLifeCount.add(-1);
if(Level_1.karmenLifeCount.getValue() == 0)
{
getWorld().removeObject(k);
}
}
}
public void moveAround()
{
if(Greenfoot.getRandomNumber(20)==1)
{
setRotation(Greenfoot.getRandomNumber(360));
}
int x = getX();
int y = getY();
if(x<=0 || y<=0 || x >= rightSideOfScreen || y >= bottomOfScreen)
{
turn(180);
}
}

