How do I make Objects fall down the same y axis but do randomized objects?
Actor actor = null;
switch (Greenfoot.getRandomNumber(3))
{
case 0: actor = new ActorA(); break;
case 1: actor = new ActorB(); break;
case 2: actor = new ActorC(); break;
}
addObject(actor, ...// outside of any method (but within the class) private int xDestination;
public void setXDestination()
{
xDestination = Greenfoot.getRandomNumber(getWorld().getWidth());
}ActorSubclassName whatever = new ActorSubclassName(); addObject(whatever, < x, y >); // wherever whatever.setXDestination();