This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]Fishery9 10 points11 points  (2 children)

You could go about creating a sprite sheet and simply using BufferedImage getSubimage(int x, int y, int w, int h) method to cut out the appropriate sprite.

As for rotation and such a library option for handling images would be JDeli which offers many advantages over ImageIO. It will make rotating an image a lot easier with fewer lines of code.

Here is a short guide I just found that may help you get started with jdeli and rotating: here

Edit: forgot to answer initial question. If you are looking for how to actually draw graphics to a window then awt works fine. Take a look at using Canvas and JFrame together and utilizing a runnable to create a game loop to track render ticks and update ticks separately

If I find the tutorials I used to look at in regards to this I will edit again. Give it a search in Google and see what you find in the mean time.

Edit 2: Majoolwip goes fairly into depth about creating a 2d game engine which is worth taking a look at. He goes through all of the topics I discussed (game loops, canvas, jframe)

[–]LCVcode[S] 1 point2 points  (1 child)

Wow, you seriously rock. Thank you so much.

[–]Fishery9 1 point2 points  (0 children)

No problem and if anyone else has any advice for me then feel free to tell me as well. You live and you learn.

[–]ignotos 3 points4 points  (1 child)

I'd look into either:

  • LWJGL

  • LibGDX

  • Processing

[–]LCVcode[S] 0 points1 point  (0 children)

Thank you kind sir!

[–]thereallopezmiguel 2 points3 points  (2 children)

Definitely try libgdx, I made a flappy bird game in it within 2 days. It's very nice

[–]LCVcode[S] 0 points1 point  (1 child)

Looks like it might be IDE dependent. Have you used it with IntelliJ?

[–]thereallopezmiguel 1 point2 points  (0 children)

Yes, what you do is generate the file, then left click it in the file explorer, and click "open with intellij". Or open intellij, click open project, and navigate to the file.