Browse Source

Merge pull request #2 from 17mgeffert/master

properly formatted comments
TryingToMakeThisALittleBetter
17mgeffert 6 years ago
committed by GitHub
parent
commit
4e223fb798
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 36 deletions
  1. +10
    -8
      src/tanks/GameElement.java
  2. +28
    -28
      src/tanks/Tanks.java

+ 10
- 8
src/tanks/GameElement.java View File

@ -18,12 +18,11 @@ public abstract class GameElement extends DrawableElement
public Area shape;
/*
checks for collision against another game element
will only work if both shape variables are set
depending on the object the shape are will be set differently
returnes true if there was a collision, false otherwise
/**
* checks for collision against another game element
* will only work if both shape variables are set
* depending on the object the shape are will be set differently
* returnes true if there was a collision, false otherwise
*/
public boolean checkCollision(GameElement e)
{
@ -34,8 +33,11 @@ public abstract class GameElement extends DrawableElement
shape.intersect(e.shape);
return !(shape.isEmpty());
}
//method that ensures that every sub-class will set their shape accordingly
/**method that ensures that every sub-class will set their shape accordingly
* @param none
* @returns none
*/
public abstract void setShape();
}

+ 28
- 28
src/tanks/Tanks.java View File

@ -203,11 +203,11 @@ public class 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
/**
* 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
{
@ -371,13 +371,13 @@ public class Tanks
}
/*
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
/**
* 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
{
@ -416,10 +416,10 @@ public class Tanks
/*
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
/**
* 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
{
@ -490,12 +490,12 @@ public class Tanks
}
/*
a turret is drawn ontop of the tank
a turret can rotate and shoot bullets,
if rotate is called, put in -1 or 1, if -1, it will
turn left, 1 will cause
it to turn right
/**
* a turret is drawn ontop of the tank
* a turret can rotate and shoot bullets,
* if rotate is called, put in -1 or 1, if -1, it will
* turn left, 1 will cause
* it to turn right
*/
private class Turret extends RotationalElement
{
@ -602,12 +602,12 @@ public class Tanks
private class Wave extends DrawableElement
{
/*fields time is continous while playing, gameMode(1=playing,
2=dead, 3=paused. spawntime keeps a countdown until next spawn,
kills keeps track of kills duh.
//4 win
1 alive and playing
0 main
/**fields time is continous while playing, gameMode(1=playing,
* 2=dead, 3=paused. spawntime keeps a countdown until next spawn,
* kills keeps track of kills duh.
* 4 win
* 1 alive and playing
* 0 main
*/
int timeCount, kills, gameMode, waveNum, spawnedTanks, spawnedZombies;
Timer spawnTank, spawnZombie, time;

Loading…
Cancel
Save