40 lines
985 B
Java
40 lines
985 B
Java
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
|
|
|
|
/**
|
|
* Write a description of class StartWorld here.
|
|
*
|
|
* @author (your name)
|
|
* @version (a version number or a date)
|
|
*/
|
|
public class StartWorld extends World
|
|
{
|
|
long x= 0;
|
|
long timer = 0;
|
|
Picture p3;
|
|
/**
|
|
* Constructor for objects of class StartWorld.
|
|
*
|
|
*/
|
|
public StartWorld()
|
|
{
|
|
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
|
|
super(600, 400, 1);
|
|
|
|
}
|
|
|
|
public void act(){
|
|
if(System.currentTimeMillis() >= timer){
|
|
p3 = new Picture(3);
|
|
addObject(p3,300,350);
|
|
x = System.currentTimeMillis() + 500;
|
|
timer = System.currentTimeMillis() + 1000;
|
|
}
|
|
if(System.currentTimeMillis() >= x){
|
|
removeObject(p3);
|
|
}
|
|
if (Greenfoot.isKeyDown("enter")){
|
|
Greenfoot.setWorld(new MenuWorld());
|
|
}
|
|
}
|
|
}
|