Browse Source

added timer to wave class plus mutator for gameMode field

pull/1/head
16nlyons 8 years ago
parent
commit
593159c240
1 changed files with 17 additions and 1 deletions
  1. +17
    -1
      src/tanks/Tanks.java

+ 17
- 1
src/tanks/Tanks.java View File

@ -387,7 +387,7 @@ public class Tanks
kills keeps track of kills duh. kills keeps track of kills duh.
*/ */
int time, kills, gameMode, waveNum; int time, kills, gameMode, waveNum;
Timer spawn;
Timer spawn, tim;
//constuctor //constuctor
public Wave() public Wave()
@ -397,8 +397,10 @@ public class Tanks
gameMode=1; gameMode=1;
waveNum=1; waveNum=1;
//actionlistener calls spawn every 2 seconds
ActionListener s = new ActionListener() ActionListener s = new ActionListener()
{ {
@Override @Override
public void actionPerformed(ActionEvent e) public void actionPerformed(ActionEvent e)
{ {
@ -406,8 +408,22 @@ public class Tanks
} }
}; };
//action listener increments time
spawn = new Timer(2000,s); spawn = new Timer(2000,s);
spawn.start(); spawn.start();
ActionListener t = new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
time++;
}
};
tim = new Timer(1000,t);
tim.start();
} }
public void setGameMode(int newGameMode) public void setGameMode(int newGameMode)
{ {

Loading…
Cancel
Save