I want my counter to go up to 15
(when my main actor collects 15 targets)
how do I achieve this?


public int getPoints() { return points; }
Counter counter = ((Counter)getWorld().getObjects(Counter.class).get(0); counter.addPoints(); if (counter.getPoints() == 15) { /** whatever you want do do */ }
{ int points=0; Counter counter = ((Counter)getWorld().getObjects(Counter.class).get(0)); counter.addPoints(); if(counter.getPoints() ==30) public void updateImage() { setImage(new GreenfootImage("Score:"+ points,35,Color.GREEN,Color.BLACK)); } public void addPoint() { points++; updateImage(); } public Counter() { updateImage(); } public int getPoints() { return points; } }