Hello I am new to Greenfoot and am currently working on a TD project the problem is that i want a tower to shoot for a certain amount of time then pause then start again Plz Anyone
/** instance field */
private int shotTimer;
/** in act */
shooting();
/** shooting method */
private void shooting()
{
shotTimer = (shotTimer+1)%600; // 600 is 60 (acts per second) times the sum of 4 plus 6 (seconds per cycle)
if (shotTimer < 240 && shotTimer%60 == 0) // timer in shooting range and of whole second value
{
System.out.println("Shot fired"); // replace to create and fire a shot somewhere
}
}