I want this block to appear if the actCounter = 90...
But I can;t seem to figure out why it isn't working...
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.Color;
import java.awt.Shape;
/**
* Write a description of class CopyOfBlock here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class CopyOfBlock extends Actor
{
private int actCounter;
private int grn = 6;
public int getTransparency;
private int bttl = 300;
private int mrn = 10;
public CopyOfBlock()
{
setRotation(90);
getImage().setColor(Color.BLACK);
fillBlock();
actCounter = 100;
secondBlock();
setTransparency();
}
public void act()
{
moveDown();
}
/**
* Change the colour of the CopyOfBlock.
*/
private void fillBlock()
{
getImage().fill();
}
public void setTransparency()
{
getImage().setTransparency(0);
}
/**
*
*/
public void actCounter()
{
actCounter--;
}
/**
* Move a random amount of steps. Call "secondBlock()".
*/
private void moveDown()
{
secondBlock();
move(Greenfoot.getRandomNumber(mrn));
}
public void secondBlock()
{
if (actCounter == 90)
{
setLocation(295, 22);
getImage().setTransparency(255);
if (getY() == 499)
{
getImage().setTransparency(0);
}
else
{
if (isTouching(Dot.class))
{
if (getTransparency !=255)
{
World world = getWorld();
world.removeObjects(world.getObjects(null)); //removes all the objects in the world;
world.addObject(new GameOver(), world.getWidth()/2, world.getHeight()/2);
//adds the game over screen in the middle of the world;
}
}
}
}
}
}
