in the center of the world i have an actor called "Center" and a circle with a diameter of 150 pixels around it.
I want to add a "Target" actor somewhere arount the circle.
then thefollowing should happen:
center sets his rotation in direction to target and summons 2 new actors +45 degrees and -45 degrees on the surface of the circle. These 2 actors go on the surface to each other until they are at the same position, center looks at. I hope you'll understand what I mean... thats waht i wrote so far:My main problems are :
- spawn the 2 actors on circle's surface(get those positions)
- let the actors move around the circle
public class Center extends Actor
{
void targeting() {
Target t = getWorld().getObjects(Target.class).get(0);
if(t != null) {
int tx = t.getX();
int ty = t.getY();
this.turnTowards(tx,ty);
}
}
}public class Main extends Actor
{
Main() {
GreenfootImage g = new GreenfootImage(150,150);
g.setColor(Color.BLACK);
g.drawOval(0,0,150,150);
g.fillOval(0,0,150,150);
g.setColor(Color.LIGHT_GRAY);
g.drawOval(5,5,140,140);
g.fillOval(5,5,140,140);
this.setImage(g);
}
}
