I had a previous thread but felt like it was getting too long. I'm trying to program a game where an arrow tile can eat other egg tiles that are the same color as the arrow but cannot go through egg tiles that are not its color. Thanks to a lot of help from a member, I was able to make the basic scenario. However, I would like new colored tiles to pop up (There are also blank tiles around the board) after a certain amount of time like ten seconds. Instead of new tiles popping up, since they are removed and converted to blank tiles when they are removed, I am trying to get a blank tile to turn into a colored tile after a certain time. I implemented this code, and no errors, but it won't work for some reason. I also forgot to mention my files are based on color, so there's egg1, egg2, etc. That's why this may look a certain way.
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Tile here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Tile extends Actor
{
private Counter counter;
private int tileDelayCount;
public Tile(Counter pointCounter)
{
counter = pointCounter;
tileDelayCount = 0;
}
/**
* Act - do whatever the Tile wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
private int color;
public Tile(int colorValue)
{
color = colorValue;
setImage(new GreenfootImage("egg"+color+".png"));
}
public int getColor()
{
return color;
}
public void getEaten()
{
color = 0;
setImage("egg0.png");
}
private void newTile()
{
tileDelayCount = 10;
}
private void checkNewTile()
{
Tile tile = (Tile)getOneObjectAtOffset(0, 0, Tile.class);
if (tileDelayCount > 0) {
tileDelayCount--;
if (tileDelayCount == 0 && tile.getColor() == 0); {
changecolor();
}
}
}
private void changecolor()
{
Tile tile = (Tile)getOneObjectAtOffset(0, 0, Tile.class);
color = Greenfoot.getRandomNumber(5)+1;
setImage("egg"+color+".png");
}
}

