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

2019/7/9

my code wont work

Coltz Coltz

2019/7/9

#
import greenfoot.*;

/**
 * Write a description of class Timer here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Timer extends Actor
{
    /**
     * Act - do whatever the Timer wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act() 
    {
        // Add your action code here.
    }    
    
    public void Timer()
    {
        getWorld().addObject(new Thirty_Three(), 300, 200);
        Greenfoot.delay(50);
        getWorld().removeObject(Thirty_Three.class);
        getWorld().addObject(new Thirty_Two(), 300, 200);
        Greenfoot.delay(50);
        getWorld().removeObjects(Thirty_Two.class);
        addObject(new Thirty_One(), 300, 200);
    }
}

Super_Hippo Super_Hippo

2019/7/9

#
What are you trying to do?
danpost danpost

2019/7/10

#
Do you: (1) create; and (2) add a new Timer object into the world before calling the Timer method on it?:
Timer timer = new Timer();
addObject(timer, 0, 0);
timer.Timer();
You need to login to post a reply.