I am programming the game don't tap the white tile in Greenfoot for school. I managed to get the script to spawn the black tiles and that they become grey, but I can't get the white tiles to become red when you click on them. My idea was to spawn one black tile at random, and in the other spots white ones that move with the black one. I just need some help with the script to make the white tiles spawn in all spots beside the black one. Here is the code I use at the start for the random spawn.
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) public class raster extends World { private Counter scoreCounter; public raster() { super(4, 4, 88); addObject(new blokje(), Greenfoot.getRandomNumber(4), 0 ); addObject(new blokje(), Greenfoot.getRandomNumber(4), 1 ); addObject(new blokje(), Greenfoot.getRandomNumber(4), 2 ); addObject(new ScoreBoard(), 2, 0 ); Example_Actor example = new Example_Actor(); addObject(example, 375, 665); addObject(new Clock(true, true, 30, "Time left:"), 0, 4); } public void alert() { getBackground().setFont(new java.awt.Font("", 1, 2)); getBackground().setColor(java.awt.Color.red); getBackground().drawString("Time up", 135, 625); } }