I am new in programming using greenfoot, I want to write a code that would make some actors to move to another different actor and they should be around the actor in a circular form. Plz any idea and guide?


for (int n=0; n<3; n++) { BigGuy bigGuy = new BigGuy(); addObject(bigGuy, /* whatever x and y */); for (int c=0; c<3; c++) { addObject(new SmallGuy(bigGuy, c), /* whatever x and y */); } }
// instance fields private Actor bigGuy; private int position; // the start of the constructor public SmallGuy(Actor actor, int pos) { bigGuy = actor; position = pos;
if (activeActor == this)
if (activeActor != this) return;
public class Student extends Actor { public void act() { //if(Greenfoot.mousePressed(this)){ move(8); setRotation(Greenfoot.getRandomNumber(360)); for(int i=0; i<5; i++) { // setRotation(Greenfoot.getRandomNumber(360)); int a=Greenfoot.getRandomNumber(600); int b=Greenfoot.getRandomNumber(600); turnTowards(a,b); } // turnTowards(200,300); //} } }
public class Student extends Actor { public void act() { move(8); setRotation(Greenfoot.getRandomNumber(360)); } }