Hello, I'm trying to keep track of a score for my game, and my current code is showing some weird message like "Object@2jksndg2" something or other. What is wrong with it? Thank you! First code snippet is from the World section (constructor), and the second is in an Actor
(just fyi, our int score = 0; is in the actor)
addObject(new Object(), 200, 200);
//addObject(new Object(), 100, 200);
updateImage();
Greenfoot.setSpeed(50);
Greenfoot.playSound("fortunateson.mp3");
Object score = new Object();
String scoreAsString = String.valueOf(score);
//String scoreAsString = new Integer(score).toString();
showText(scoreAsString, 350, 20); private void checkSoldierdHit()
{
Soldier soldier = (Soldier) getOneIntersectingObject(Soldier.class);
if (soldier != null){
getWorld().removeObject(soldier);
Greenfoot.playSound("yee.mp3");
score += 1;
}
}
public int getScore()
{
return score;
}

