Hi,
I have a code where two players eat victims and the one that eats the most victims wins. I don't it to show the player the specific counter of how many victims they've eaten, I just want it show who's in the lead (or if it's a draw). I've made a Counter class, a subclass of Actor and the text shows but it's stuck on "It's tied!" because that's what it shows at the start of course since its 0:0 at the beginning.
Thanks in advance :)
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
public class Counter extends Actor
{
public int victimsEatenP1;
public int victimsEatenP2;
public void act() //zeigt an, welcher Spieler gerade in Führung ist (= mehr victims gefressen hat)
{
if (victimsEatenP1 > victimsEatenP2) // vergleicht die gegessenen victims und liefert je nach dem den richtigen Text
setImage(new GreenfootImage("Player 1 is in the lead", 40, Color.WHITE, new Color(0, 0, 0, 0)));
if (victimsEatenP2 > victimsEatenP2)
setImage(new GreenfootImage("Player 2 is in the lead", 40, Color.WHITE, new Color(0, 0, 0, 0)));
if (victimsEatenP1 == victimsEatenP2)
setImage(new GreenfootImage("It's tied!", 40, Color.WHITE, new Color(0, 0, 0, 0)));
}
}

