Before I start, I'd like to mention that I'm new to programming and I'm really bad. If you can think of ANY reason as to what may be causing my issue, it's probably worth checking.
I'm making a game where the user controls a shark and has to move around, eating the fish and dodging the trash. The user gets a point whenever they eat a fish. I've been having an issue where the program says it can't find a method and I can't seem to figure it out.
Here is where the error is. It's in the Food class (the fish, what the shark eats):
Actor foodHit = getOneIntersectingObject(Shark.class);
if(foodHit!=null)
{
World MyWorld = (World)MyWorld;
Counter counter = World.getCounter();
// The error is apparently in this line above, here's the error code: "cannot find symbol - method getCounter()".
counter.addScore();
MyWorld.removeObject(this);
}
This is the method in question, it is in the MyWorld class:
public Counter getCounter()
{
return counter;
}
I can answer any questions and show more lines if you request. I know it's frustrating to deal with new people sometimes so I'm sorry in advance. Any help would be amazing, thanks for reading!