# In Java swing, while handling a 2D top down game, how should I handle scaling for quality transformations (mainly screen rotation)

For my top down game, I plan to have screen rotation where entities don't rotate, but everything else does. I am using a raster array to store my image so I don't have to render things stacked on each other. I have my game scaled by three, however so pixels are 3 times as large and take up 9 times more space meaning that when I do a matrix rotation for everything except the player and entities, the pixels are very badly rotated as it is rotating then scaling afterwards.

Essentially, I copy whatever pixels I need to to the main image (both arrays of pixels), then after that it is scaled by three and drawn to the actual screen (with the Java Graphics). Mainly, I would like to do quality rotations and scaling means that I cannot do that.

Also off a little bit from the question, how would you recommend I handle the rotation so that the entities stay upright and everything except the map moves while keeping collision and logic working fine. Similar to how the game Realm of the Mad God works.

I am willing to change my rendering logic a bit, however I want to keep it as efficient as possible. I can also change my game into 3D in order to have higher quality walls and such.

Overall, I am asking: How should I handle scaling so that I can use high quality transformations and how would I efficiently and effectively implement screen rotation.

All help is appreciated, thanks.

• You should use Java2D transformations for rotating and scaling images. This way you get both quality and performance in an easy way. – msell Apr 21 '15 at 6:45
• Should I use multilayer rendering then? I have a pixel arrray which I draw things to, then I scale it to fit the window. I know I could just draw the entities on a separate layer however then performance is hit a little bit. – Meeesh Apr 21 '15 at 17:09
• Why do you want to draw to a pixel array first? I think you need to provide some pictures to clarify what you are really after. – msell Apr 22 '15 at 4:39