How do I get it to not be able to do the proton wave for 30 seconds after you use it?
private int reloadTime = 0;
public void act()
{
//All of your other code for the player character
checkInput();
}
private void checkInput()
{
//All of your other code for controls
if (Greenfoot.isKeyDown("Space") && reloadTime <= 0)
{
reloadTime = 1500;
fireProtonWave(); //Whatever method you're using to shoot
}
reloadTime--;
}import greenfoot.*;
public class TestWorld extends World
{
long startTime;
int acts;
int seconds;
public TestWorld()
{
super(1, 1, 1);
}
public void started()
{
startTime = System.currentTimeMillis();
}
public void act()
{
acts++;
if ((System.currentTimeMillis()-startTime)/1000 > seconds)
{
seconds++;
System.out.println("acts per second: "+acts);
acts = 0;
}
}
}