alright i figured it out, i just need to know how to decrease the "bar"'s value as my characters health goes down.
ignore the setbar because that's what I need to know, how do I get it to detect my characters health and change to that value?
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.Color;
import java.awt.GraphicsEnvironment;
import java.awt.Font;
/**
* Write a description of class SomeWorld here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class CellGames extends World
{
Bar bar = new Bar("Cell", "HP", 900000, 900000);
Cell cell = new Cell();
int cHlth = cell.getHealth();
/**
* Constructor for objects of class SomeWorld.
*
*/
public CellGames()
{
super(900, 650, 1);
prepare();
addObject(bar, 600, 10);
addObject(cell, 600, 390);
setbar();
}
private void prepare ()
{
Gohan gohan = new Gohan();
addObject(gohan, 200, 450);
Fight fight = new Fight();
addObject(fight, 400, 300);
}
public void setbar(){
if (bar.getValue() == bar.getMinimumValue())
{
}
if (cHlth <= 900000)
{
bar.setValue(-1500);
}
}
}

