Hot answers tagged

1

i would suggest that you do some work on your design - it is a very good idea to rethink your design to make better (less bugs) 🐜 , better to test & maintain and even adding new features. refactoring into dynamic context You can move your whole static code into a dynamic context once you start your static main method public class Game { //static ...


1

This is what I figured out and it works, but Martin's answer is probably a lot more efficient. I went ahead and used the array of y values that I made, and then below it made a bunch of code segments like this: for (int i = 0; i < yValues.length; i++) { if (sprite.getY() == yValues[i]) { g2d.drawImage(sprite.getImage(), sprite.getX(), ...


1

instead of trying to identify the drawing order for each sprite itself you should create a proper drawing order first of. List<Sprite> sprites; Comparator<Sprite> topLeftComparator; void draw(Graphics graphics){ sprites.sort(topLeftComparator); //create proper drawing order first for (Sprite sprite: sprites){ sprite.draw(...


Only top voted, non community-wiki answers of a minimum length are eligible