hello, guys ...
I'm developing a game with Greenfoot, I'm beginner and would like to create a progress bar of life, but it does not know where to start, could someone give me a light?


1 2 3 4 5 6 7 8 9 10 11 12 | switch (life) { case 1 : setLocation(anXPosition, anYPosition); break ; case 2 : setLocation(anXPosition, anYPosition); break ; case 3 : setLocation(anXPosition, anYPosition); break ; ... } |
1 2 3 4 5 6 7 | //write this at the top above your class declaration import java.awt.Color; getImage().clear(); // clears your image; getImage().scale(x, y) // changes the size of your image; getImage().setColor(Color.green); // or what Color you'd like to use; getImage().fillRect(x, y, x2, y2); // makes a green (or other colored) rect. You can change the size to get a different bar. |