This site requires JavaScript, please enable it in your browser!
Greenfoot back
programmer22
programmer22 wrote ...

2012/2/12

restart

programmer22 programmer22

2012/2/12

#
import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.Color;
/**
 * Write a description of class Button here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Button extends Actor
{
public Button()
{
    setImage(new GreenfootImage(" Try again ", 30, Color.BLACK, Color.RED));
}

 public void act();
        if(greenfoot.mouseClicked(this))
        {
            CrabWorld gw = (CrabWorld) getWorld();
            gw.addObject(new Crab ().(257,300);
                gw.Prepare();
                gw.resetVariables();
                gw.removeObject(this);
            }
        }
   
ok i want to be able to click the try again button on my game and make it restart but im having difficultys with the coding heres what i have so far any ways it says if(greenfoot.mouseClicked(this)) is an illeagle start of type any ideas?
danpost danpost

2012/2/12

#
In line 17, the world greenfoot should be capitalized to 'Greenfoot'.
You need to login to post a reply.