so i got a dolphin class that removes the wombats from my game but the scoreboard comes up with the error cannot find symbol- variable dolphin when i try to place it before i run the game.
dolphin class
Scoreboard class:
public class Dolphin extends Actor { public int WombatsStopped=0; private int direction, speed; int delay = 1; public Dolphin(int dir) { direction = dir; speed = 15; } /** * Act - do whatever the Dolphin wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { setRotation(direction); move(7); Stuff(); } public void Stuff() { Actor actor = getOneIntersectingObject (Wombat.class); { int xCoord = getX(); int yCoord=getY(); if (xCoord >= 1799 || xCoord <=1 ||yCoord >= 999 || yCoord <=1 ) { World Road = getWorld(); Road.removeObject (this); } if (actor != null) { Road RoadWorld = (Road)getWorld(); RoadWorld.removeObject (actor); RoadWorld.removeObject (this); WombatsStopped++; } } } public int getscore() { return WombatsStopped; } }
public class Counter extends Actor { private static final Color TEXT_COLOR = new Color(200, 0, 0); private static final Color TRANSPARENT_COLOR = new Color(0, 0, 0, 0); private Dolphin dolphin ; public Counter(Dolphin dolphin) { this.dolphin = dolphin; updateImage(); } public void act() { updateImage(); } private void updateImage() { String text = "Wombats Stopped" + dolphin.getscore(); GreenfootImage image = new GreenfootImage(text, 20, TEXT_COLOR, TRANSPARENT_COLOR); setImage(image); } }