Here is one class CriticalBar I have that needs to access the variable returned from a getter method in another class HealthBar
but now it says "non static method getHp() cannot be referenced from a static context." how can i fix this so that i can display the current Hp of the HealthBar on the CriticalBar actor?
/** * Creates a new image with text saying "Low Energy Remaining" and sets it to the CriticalBar actor */ public CriticalBar() { bar = new GreenfootImage("LOW ENERGY REMAINING! " + HealthBar.getHp(), 20, Color.RED, new Color(0,0,0,0)); this.setImage(bar); }