Hello
When I try and compile the code below it tells me that the counter is not an int so I cannot do it. Any ideas how to fix this?
if (passengersleft==0&&counter>0){ win=true; }
if (passengersleft==0&&counter>0){ win=true; }
if (passengersleft==0 && counter.getValue() > 0) { win=true; }
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) import java.awt.Color; public class Counter extends Actor { private int totalCount = 20; public Counter() { setImage(new GreenfootImage("20", 30, Color.WHITE, Color.BLACK)); } public void bumpCount(int amount) { totalCount += amount; setImage(new GreenfootImage("" + totalCount, 20, Color.WHITE, Color.BLACK)); } }
public int getCount() { return totalCount; }
public int getValue() { return totalCount; }
if (passengersleft==0 && counter.getCount() > 0) { win=true; }