frequency wrote...
What? Its empty? The code is nearly the same
<< Code Omitted >>
thats it lol
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class World_30 here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class World_90 extends World
{
/**
* Constructor for objects of class World_90.
*
*/
private static int score=0;
public World_90()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(1500, 800, 1);
checkKeyboard();
addObject(new ninety_seconds(),120,90);
addObject(new Score90(),400,700);
}
void checkKeyboard()
{
if (Greenfoot.isKeyDown("space"))
{
score=score+1;
}
}
public static int getScore()
{
return score;
}
}
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.Color;
/**
* Write a description of class Score here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Score90 extends Scores
{
private static final Color TEXT_COLOR=new Color(200,0,0);
private static final Color TRANSPARENT_COLOR=new Color(0,0,0,0);
/**
* Act - do whatever the Score wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
private void updateImage()
{
}
public void act()
{
updateImage();
}
public Score90()
{
updateImage();
}
}
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class thirty_seconds here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class ninety_seconds extends Actor
{
public static int score=0;
boolean bla=false;
public void act()
{
if(Greenfoot.mouseClicked(this))
{
Greenfoot.setWorld(new World_90());
}
if (Greenfoot.isKeyDown(" ") && bla==false){
checkKeyboard();
bla=true;
}
else if(!Greenfoot.isKeyDown(" ") && bla==true){
bla=false;
}
}
void checkKeyboard()
{
if (Greenfoot.isKeyDown("space"))
{
score=score+1;
}
}
public static int getScore()
{
return score;
}
}
private static int score=0;
private static int score=0;
if (endTime == 0 && Greenfoot.isKeyDown("space")) endTime = 30000+System.currentTimeMillis();
if (endTime == 0) return;
// calculate time remaining and adjust display hereimport greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.Color;
/**
* Write a description of class Timer here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Timer30 extends thirty_seconds
{
private static final Color TEXT_COLOR = new Color(255,255,255);
private static final Color TRANSPARENT_COLOR = new Color(0,0,0,0);
private long timeStarted;
private int seconds=10;
/**
* 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 Timer()
{
updateImage();
timeStarted=System.currentTimeMillis();
}
public void act()
{
updateImage();
Timer();
if (System.currentTimeMillis()-timeStarted>1000)
{
timeStarted=System.currentTimeMillis();
seconds--;
}
}
private void updateImage()
{
String text="Seconds left";
GreenfootImage image =new GreenfootImage(text,30,TEXT_COLOR,TRANSPARENT_COLOR);
setImage(image);
}
}