Basically whats happening is the tiles are suppose to turn green when pressed in a certaint order. But right now they don't turn green even though it is saying that it was pressed
Heres an example of one tile
public void act()
{
if (tileBeggining!=220)
{
if(tileBeggining==1 && tileSelection.Memory1==1)
setImage("Tile Yellow.png");
else if (tileBeggining==1)
setImage("Tile Gray.png");
if(tileBeggining==40 && tileSelection.Memory2==1)
setImage("Tile Orange.png");
else if (tileBeggining==40)
setImage("Tile Gray.png");
if(tileBeggining==80 && tileSelection.Memory3==1)
setImage("Tile Yellow.png");
else if (tileBeggining==80)
setImage("Tile Gray.png");
if(tileBeggining==120 && tileSelection.Memory4==1)
setImage("Tile Orange.png");
else if (tileBeggining==120)
setImage("Tile Gray.png");
if(tileBeggining==160 && tileSelection.Memory5==1)
setImage("Tile Yellow.png");
else if (tileBeggining==160)
setImage("Tile Gray.png");
if (tileBeggining==200)
setImage("Tile Gray.png");
tileBeggining++;
}
else{
MouseInfo mi = Greenfoot.getMouseInfo();
tileRest();
if (tileNumber==1 && tileSelection.Memory1==1)
{
if (Greenfoot.mouseClicked(this))
correct();
}
else if (tileNumber==1)
{
if (Greenfoot.mouseClicked(this))
inCorrect();
}
if (tileNumber==2 && tileSelection.Memory1==1){
if (Greenfoot.mouseClicked(this))
correct();}
else if (tileNumber==2){
if (Greenfoot.mouseClicked(this))
inCorrect();}
if (tileNumber==3 && tileSelection.Memory1==1){
if (Greenfoot.mouseClicked(this))
correct();}
else if (tileNumber==3){
if (Greenfoot.mouseClicked(this))
inCorrect();}
if (tileNumber==4 && tileSelection.Memory1==1){
if (Greenfoot.mouseClicked(this))
correct();}
else if (tileNumber==4){
if (Greenfoot.mouseClicked(this))
inCorrect();}
if (tileNumber==5 && tileSelection.Memory1==1){
if (Greenfoot.mouseClicked(this))
correct();}
else if (tileNumber==5){
if (Greenfoot.mouseClicked(this))
inCorrect();}
if(TilePressed==true)
{
if(t15==50)
{
TilePressed=false;
t15=0;
tileNumber++;
setImage("Tile Gray.png");
}
else
t15++;
}}
if (tileNumber==6)
{
setImage("Tile Green.png");
tileNumber++;
}
}
public void tileRest()
{
}
public void inCorrect()
{
setImage("Tile Red.png");
fail=true;
}
public void correct()
{
setImage("Tile Green.png");
TilePressed=true;
}
And the code that is setting tileselction.Memory#'s
tileSelection.Memory1=Greenfoot.getRandomNumber(5)+1;
tileSelection.Memory2=Greenfoot.getRandomNumber(5)+1;
tileSelection.Memory3=Greenfoot.getRandomNumber(5)+1;
tileSelection.Memory4=Greenfoot.getRandomNumber(5)+1;
tileSelection.Memory5=Greenfoot.getRandomNumber(5)+1;
and there is no code in tile Selection