|
@ -1,48 +1,96 @@ |
|
|
|
|
|
/* |
|
|
|
|
|
Set 3 programming project |
|
|
|
|
|
5-18-16 |
|
|
|
|
|
*****************Tanks*************** |
|
|
|
|
|
https://github.com/jrtechs/Tanks/wiki |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
package tanks; |
|
|
package tanks; |
|
|
|
|
|
|
|
|
import javax.swing.JFrame; |
|
|
import javax.swing.JFrame; |
|
|
import javax.swing.JPanel; |
|
|
import javax.swing.JPanel; |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* |
|
|
|
|
|
* Set 3 class project |
|
|
|
|
|
* 5-19-16 |
|
|
|
|
|
* |
|
|
|
|
|
*/ |
|
|
|
|
|
public class Tanks |
|
|
public class Tanks |
|
|
{ |
|
|
{ |
|
|
//fields |
|
|
//fields |
|
|
private JFrame f; |
|
|
|
|
|
|
|
|
private JFrame frame; |
|
|
private JPanel panel; |
|
|
private JPanel panel; |
|
|
private int kills; |
|
|
|
|
|
|
|
|
|
|
|
//constructor |
|
|
//constructor |
|
|
public Tanks() |
|
|
public Tanks() |
|
|
{ |
|
|
{ |
|
|
//this is a test by bryce |
|
|
|
|
|
//this is a test push by Matt |
|
|
|
|
|
//this is a push by Mike R |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
private class Player extends RotationalElement |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//creates a new instance of tanks to run |
|
|
|
|
|
public static void main(String[] arguments) |
|
|
{ |
|
|
{ |
|
|
//This is a test by emily |
|
|
|
|
|
|
|
|
Tanks runnable = new Tanks(); |
|
|
} |
|
|
} |
|
|
private abstract class Enemy extends RotationalElement |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
Sub-classes that require the fields in tanks |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
the player class which extends the living class |
|
|
|
|
|
a player has a turret and an int kills |
|
|
|
|
|
a player has a specialized move method |
|
|
|
|
|
a player has a update direction method which takes in a keyevent |
|
|
|
|
|
*/ |
|
|
|
|
|
private class Player extends Living |
|
|
{ |
|
|
{ |
|
|
//this is a test by nick |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
A zombie extends Enemy |
|
|
|
|
|
a zombie has a specialized move method which |
|
|
|
|
|
moves it twards the player |
|
|
|
|
|
|
|
|
|
|
|
the move method checks to see if it collides with the player |
|
|
|
|
|
if so it removes itself from the arraylist in tanks and deducts damage |
|
|
|
|
|
*/ |
|
|
private class Zombie extends Enemy |
|
|
private class Zombie extends Enemy |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
a bullet moves at a specified angle |
|
|
|
|
|
if the bullet collides with a enemy it gives damage |
|
|
|
|
|
if the bullet goes off the screen it removes itself from the arraylist |
|
|
|
|
|
*/ |
|
|
private class Bullet extends RotationalElement |
|
|
private class Bullet extends RotationalElement |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//creates a new instance of tanks to run |
|
|
|
|
|
public static void main(String[] arguments) |
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
a turret is drawn ontop of the tank |
|
|
|
|
|
a turret can rotate and shoot bullets |
|
|
|
|
|
*/ |
|
|
|
|
|
private class Turret extends RotationalElement |
|
|
{ |
|
|
{ |
|
|
Tanks runnable = new Tanks(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
private class Tank extends Enemy |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |