before this code i set lives to 3, and whenever i hit an object 1 gets subtracted from lives. Using other methods works (such as adding or removing other object) so I'm sure its an issue with removing the lives specifically.
public void health()
{
Lives life1=new Lives();
Lives life2=new Lives();
Lives life3=new Lives();
if (lives==3)
{
getWorld().addObject(life1,20,20);
getWorld().addObject(life2,60,20);
getWorld().addObject(life3,100, 20);
}
if (lives==2)
{
getWorld().removeObject(life3);
}
if (lives==1)
{
getWorld().removeObject(life2);
}
if (lives==0)
{
getWorld().removeObject(life1);
}
}