so i make class where time >= 1000 , the move speed get increase.
but after i reset the greenfoot , the move speed still at the increase time , not back to normal .
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class SmoothMover here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class SmoothMover extends Actor
{
/**
* Act - do whatever the SmoothMover wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
private static int accB = 4;
private static int accM = 2;
private static int accM2 = 6;
int time;
private int scoreTime =0;
public void speedBrick()
{
addSpeed();
setLocation(getX(), getY()+accB);
return;
}
public void speedMobil()
{
addSpeed();
setLocation(getX(), getY()+accM);
return;
}
public void speedMobil2()
{
addSpeed();
setLocation(getX(), getY()+accM2);
return;
}
public void addSpeed()
{
if(time >= 1500)
{
accB = accB+ 2;
accM = accM+ 1;
accM2 = accM2+3;
time = 0 ;
Greenfoot.playSound("addSpeed.wav");
}
time++;
}
public void checkout(String verify)
{
if (getWorld() != null && (this.atWorldEdge()) ) {
if(verify.equalsIgnoreCase("t")){
//getWorld().addObject(new Brick(), 13, 5);
getWorld().addObject(new Brick(), 150, 7);
getWorld().removeObject(this);
return;
}
else{
//getWorld().addObject(new Brick(), 13, 5);
getWorld().removeObject(this);
return;
}
}}
public boolean atWorldEdge()
{
if(getWorld() != null && (getX() < 5 || getX() > getWorld().getWidth() - 5))
return true;
if(getWorld() != null && (getY() < 5 || getY() > getWorld().getHeight() - 5))
return true;
else
return false;
}
}

