If you do not mind, share it here on the site with the "provide source code" checkbox checked so that it can be inspected.
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Rock here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Rock extends Actor
{
//amount of rock you have
int rockCounter;
private boolean mineDown;
/**
* Act - do whatever the Rock wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
rock();
}
//adds to rock counter if touching tree and space is down
public void rock()
{
if (mineDown != Greenfoot.isKeyDown("space"))
{
mineDown = !mineDown;
if (mineDown && isTouching(Survivor.class))
{
rockCounter++;
getWorld().showText("Rock:" + rockCounter, 100, 100);
}
}
}
public Rock()
{
GreenfootImage myImage = getImage();
int myNewHeight = (int)myImage.getHeight()/30;
int myNewWidth = (int)myImage.getWidth()/30;
myImage.scale(myNewWidth, myNewHeight);
}
}