From b4679f03ec85a3f6325c5b0b27a13d7bde7264ef Mon Sep 17 00:00:00 2001 From: emilydec Date: Thu, 26 May 2016 09:24:02 -0400 Subject: [PATCH] Created wave class --- src/tanks/Tanks.java | 47 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/tanks/Tanks.java b/src/tanks/Tanks.java index 2bb420c..fa3b93d 100644 --- a/src/tanks/Tanks.java +++ b/src/tanks/Tanks.java @@ -301,4 +301,51 @@ public class Tanks } + private class Wave extends DrawableElement + { + /*fields time is continous while playing, gameMode(1=playing, + 2=paused, 3=menu. spawntime keeps a countdown until next spawn, + kills keeps track of kills duh. + */ + int time, kills, gameMode, waveNum; + Timer spawn; + + //constuctor + public Wave() + { + time=0; + kills=0; + gameMode=1; + waveNum=1; + + ActionListener s = new ActionListener() + { + + @Override + public void actionPerformed(ActionEvent e) + { + spawn(); + } + + }; + spawn = new Timer(2000,s); + spawn.start(); + + } + + + //spawn method checks if spawn timer ==0 and if so then spawns an + //enemy + public void spawn() + { + + Enemy temp = new Enemy(); + temp.spawn(frame); + enemy.add(temp); + + } + + + //timer + } }