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

2013/11/16

more helps

KevinWelch2001 KevinWelch2001

2013/11/16

#
I want it so when you click the start button it changes to gameworld but it wont work here is the code for gameworld.
import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class start here.
 * 
 * @author (kevin welch) 
 * @version (1.0)
 */
public class start extends Actor
{
    /**
     * Act - do whatever the start wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void clicked() 
    {
        if (Greenfoot.mouseClicked(this))
        {
            setWorld(gameworld); 
        }
    }    
}
davemib123 davemib123

2013/11/16

#
you would want this in the act method:
 if (Greenfoot.mousePressed(this))
            {
                Greenfoot.setWorld(new gameworld());
            }
KevinWelch2001 KevinWelch2001

2013/11/16

#
it wont work
davemib123 davemib123

2013/11/16

#
post up, the edit you made
KevinWelch2001 KevinWelch2001

2013/11/16

#
import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class start here.
 * 
 * @author (kevin welch) 
 * @version (1.0)
 */
public class start extends Actor
{
    /**
     * Act - do whatever the start wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void clicked() 
    {
         if (Greenfoot.mousePressed(this))
            {
                Greenfoot.setWorld(new gameworld());
            }
    }    
}
davemib123 davemib123

2013/11/16

#
Change:
public void clicked()  
to:
public void act()  
KevinWelch2001 KevinWelch2001

2013/11/16

#
ok ty
You need to login to post a reply.