I'm trying to add levels to my game and having trouble with it. In the prepare(), the getOrcCount() is a can't find symbol error. The code is supposed keep count of the number of orcs and set maxScore equal to the number of orcs. then when OrcCount equals maxScore it changes the level.
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class MyWorld here. * * @author Group 18 * @version (a version number or a date) */ public class Field extends World { Counter counter = new Counter(); private static final int OrcTimer = 150; private Knight player; private int orc; HealthBar healthbar = new HealthBar(); GreenfootSound backgroundMusic = new GreenfootSound("castledefendertheme.mp3"); public Field() { // Create a new world with 600x400 cells with a cell size of 1x1 pixels. super(600, 400, 1); prepare(); orc = 0; populate(1); int OrcCount = 1; } public Location getSafeOrcLocation(double distance) { int playerX = player.getX(); int playerY = player.getY(); int randX = (int)(Math.random() * 701) + 100; int randY = (int)(Math.random() * 701) + 100; double howFar = Math.sqrt(Math.pow(playerX-randX,1) + Math.pow(playerY-randY,2)); while(howFar < distance) { randX = (int)(Math.random() * 701) + 100; randY = (int)(Math.random() * 701) + 100; howFar = Math.sqrt(Math.pow(playerX-randX,1) + Math.pow(playerY-randY,2)); } return new Location(randX, randY); } public void started() { backgroundMusic.play(); } public void stopped() { backgroundMusic.stop(); } private void prepare() { addObject(healthbar, 155, 66); caslte newCaslte = new caslte(); addObject(newCaslte, 31, 237); Knight newKnight = new Knight(); addObject(newKnight, 90, 335); Firemagic newFiremagic = new Firemagic(); addObject(newFiremagic, 573, 23); addObject(counter, 55, 26); if (player.getOrcCount() == maxScore()) { Greenfoot.delay(100); } } public HealthBar getHealthBar() { return healthbar; } public Counter getCounter() { return counter; } public void populate (int orc) { for (int orcAdded = 0; orcAdded < orc; orcAdded++) { Orc o = new Orc(); Orc o2 = new Orc(); addObject(o, 550, 360); addObject(o2, 550, 300); } } public int maxScore() { return orc; } }