hello, so i tried making a scoreboard which works when i kill the first enemy, after that each time i kill an enemy the score keeps at 5 i know why, but i dont know the solution, it is caused because its repeating making the scoreboard. Anyone please help?
heres the code
public void killEnemy()
{
try {
if(canSee(Enemy1.class))
{
Enemy1 enemy1 = (Enemy1) getOneObjectAtOffset(0, 0, Enemy1.class);
if (isTouching(Enemy1.class))
{
enemyCounter= enemyCounter + 5;
}
Level3 level3 = (Level3)getWorld();
World world = getWorld();
world.removeObjects(world.getObjects(EnemyCounter.class));
world.addObject (new EnemyCounter(enemyCounter), 100, 50);
removeObject(Enemy1.class);
getWorld().removeObject(this);
}
} catch (IllegalStateException ex)
{
//do nothing
}
}

