This site requires JavaScript, please enable it in your browser!
Greenfoot back
bombrz
bombrz wrote ...

2017/5/17

How to add an actor at a specific time.

bombrz bombrz

2017/5/17

#
I'm trying to add wombats into my program for a final project for a computer science class. What I'm trying to do is at a specified time add womabts into the world. My code is shown below, when I try to compile the code it says that by the a and b is an " ')' is expected is there something I'm not doing right or go about doing this a different way? I tried a while loop as well but that also did not work. /** * This method is for adding wombats into the world */ public void addWombat() { if (time < 231) { int a = Greenfoot.getRandomNumber(500); int b = Greenfoot.getRandomNumber(400); Wombat wombat = new Wombat(); addObject(new Wombat() a, b); } }
bombrz bombrz

2017/5/17

#
I don't know if it helps but its a subclass.
bombrz bombrz

2017/5/17

#
neverminf i figured it out
You need to login to post a reply.