Hi there,
Hello. :-)
I'm trying to write a 4k contest entry and I'm a bit stuck. I've not done any Java2d stuff before.
Welp, this is the place for help. :-)
I have an int[][] which contains a list of colour indexes e.g. 0 is transparent, 1 is black 2 is white etc. and I have a sprite setup in this format of size 16x16.
Funny. Sounds
very familiar. :-)
Now as the player turns I want to rotate this sprite around a given point. I'm currently drawing my sprite using a two for loops (inner and outer) and a drawPixel method I wrote.
Well, you can read
this article for info on how to do that. Personally, I think you're better off loading data into a BufferedImage and using that. My
SuperPack and SuperPackME tools can do that for you automagically. That's why I wrote them. :-)
Just an FYI, if you're not using many images (e.g. 1 16x16 image) then you're going to lose more than you gain by encoding the images like you did. If you look at my
Defender 4000 entry from last year, you'll notice that I packed in 21 images, thus making the decoder worthwhile.
PS: Reading a bit more Javadoc, I'll now ask the question, do I need to somehow use an AffineTransform to solve this?
That is probably the best way to do it.