Browse Source

just doing a test

pull/1/head
16mbishop 8 years ago
parent
commit
fe85ebab77
1 changed files with 36 additions and 0 deletions
  1. +36
    -0
      src/tanks/Living.java

+ 36
- 0
src/tanks/Living.java View File

@ -9,5 +9,41 @@ package tanks;
public class Living extends RotationalElement public class Living extends RotationalElement
{ {
public int health;
public boolean isAlive;
public Living()
{
health=0;
isAlive=true;
}
public void setHealth(int holdH)
{
health=holdH;
}
public void setAlive(boolean holdA)
{
isAlive=holdA;
}
public int getHealth()
{
return health;
}
public boolean getAlive()
{
return isAlive;
}
/*
when method is called,takes health away from living object,
if health is less than 0, is alive = false
*/
public void takeDamage()
{
health-=10;
if(health<=0)
{
isAlive=false;
}
}
} }

Loading…
Cancel
Save