Hi,
I am working on a project and I need to make each of the 5 orbs I create in the OrbWorld have random velocities. With what I have so far, it seems that all the orbs move at the same velocity. Where did I go wrong? Thanks!
public class OrbWorld extends World { /** * Constructor for objects of class OrbWorld. * */ public OrbWorld() { super(600, 400, 1); // Create a new world with 600x400 cells with a cell size of 1x1 pixels. populateWorld(); } public void populateWorld() { Random rn = new Random(); int x,y; for(int i=1;i<=5;i++) { x = rn.nextInt() % 500; y = rn.nextInt() % 300; addObject(new Orb(x,y),x,y); } } }