I'm trying to make it so that in my game an actor (EATER) creates a balloon (I spelled it wrong in the code but that is what I'm talking about) every 5 seconds. The problem is that I'm getting a Greenfoot error that says, "Void type not allowed here." I put the code for my EATER bellow. Please help me and ask if you need any more code.
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class EATER here. * * @author (your name) * @version (a version number or a date) */ public class EATER extends Actor { /** * Act - do whatever the EATER wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { long lastAdded = System.currentTimeMillis(); long curTime = System.currentTimeMillis(); if (curTime >= lastAdded + 5000) //5000ms = 5s { Ballon ballon = new Ballon (getWorld(). addObject(ballon,200,200)); lastAdded = curTime; } } }