In trying to create code that spawns actors every few seconds, I get the error "Can't find symbol - method mainEnemy"
This is the code:
I assume I need to set MainPlayer equal to something, but I haven't been able to find a solution.
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class MainPlayer here.
*
* @author (Danny)
* @version (1.0)
*/
public class MainPlayer extends Actor
{
int speed = 3;
public void act()
{
moveAround();
checkObstacle();
throwBall();
}
private void enemySpawn()
{
spawnTimer = (spawnTimer+10)%600;
if (spawnTimer == 0)
{
MainEnemy mainEnemy = getWorld().getObjects(MainEnemy.class).get(0);
getWorld().addObject(mainEnemy(), 0, 0);
}
}
}
