im trying to make it so that it adds the 3 things randomly and while i was doing the prepare() method it kept saying illegal start of expression and idk what i am doing wrong. Im kind of new to java.
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class MyWorld here. * * @author (your name) * @version (a version number or a date) */ public class MyWorld extends World { /** * Constructor for objects of class MyWorld. * */ public MyWorld() { super(800, 600, 1); showText("Use the arrow keys to move", 400 , 200); showText("Collect 50 balloons or 10 fish to win", 400 , 250); showText("If you hit a bomb you lose", 400 , 300); if (Greenfoot.isKeyDown("s")) { act(); //prepare(); } private void prepare() { for(int i = 0; i < 70; i++) { //Got the int x and int y from a youtube video by BRaditechUK int x = Greenfoot.getRandomNumber(getWidth() - 1); int y = Greenfoot.getRandomNumber(getHidth() - 1); addObject(new Balloon(), x, y); } for(int i = 0; i < 25; i++) { int x = Greenfoot.getRandomNumber(getWidth() - 1); int y = Greenfoot.getRandomNumber(getHidth() - 1); addObject(new fish(), x, y); } for(int i = 0; i < 15; i++) { int x = Greenfoot.getRandomNumber(getWidth() - 1); int y = Greenfoot.getRandomNumber(getHidth() - 1); addObject(new Bomb(), x, y); } } }