So I’ve been wanting to figure out how to use sprites in Java. I know how the concept works and all that, since I’ve used them in html/css for a while now.
But I’m not sure how to implement it in Java? Also, how can i make them so that the sprites are in, say 8 colors, and those colors can be changed on the fly by the game?
Hope i’m not to late, believe everything above should work, but other members here frown upon the way i do things so wait for others opinions if mine doesn’t cut it for drawing sprites.
You can’t directly draw an ImageIcon, you have to get the Image from it first. However, it is much cleaner to get the image using javax.imageio.ImageIO.
A Sprite should basically be a class that stores the X, Y, width, height, image(s), and other variables that might be important.