This site requires JavaScript, please enable it in your browser!
Greenfoot back
SomeRandomStuff
SomeRandomStuff wrote ...

2014/12/17

Health Bar Class by danpost, How do i make it so it removes health from another class?

SomeRandomStuff SomeRandomStuff

2014/12/17

#
So I am trying to make a ship game and it won't let me decrease the health bar when something hits it. Here is my code for now
 public void act() 
    {
      setLocation(getX(), getY()+1);
       if( getY()>=getWorld().getHeight()-0)
      {
          getWorld().removeObject(this);
          bar.setValue(bar.getValue()-1);
      }
    }    
}
I just want to remove health from my Player and not from the enemy ship. Please Help!
SomeRandomStuff SomeRandomStuff

2014/12/17

#
Wait never mind! I figured it out! Derp :D
You need to login to post a reply.