Hi! I was just trying to make an space invaider type of game and was wondering how I can only select one thing out of a bunch. For Example: I have 10 spacecrafts and only want one to shoot. Is there a way to do that? Thanks!
java.util.List crafts = getObjects(Spacecraft.class); if ( ! crafts.isEmpty() ) ((Spacecraft) crafts.get(Greenfoot.getRandomNumber(crafts.size()))).shoot();