I was wondering if it was possible to add an object to the world if the Building constructor has been called into a world. I would like to know if you can get the X and Y value of the Building in the world if it was called.
1 2 3 4 5 6 7 8 9 | private StatBar healthBar = new StatBar( 100 , currentHp, null , 100 , 10 , 0 , Color.GREEN, Color.RED, false , Color.WHITE, 1 ); public Building(){ World world = getWorld(); image = drawBuilding(); setImage (image); world.addObject(healthBar, (Building. class ).getX(), getY() - 50 ); } |