I'm dealing with objects on 15x15 chunks in my game.
I'd like the chunks to rotate, for example, rotation version 0 is the original position of 2,5;
(EDIT: Oops, rotation 2 and 3 names need switching in the image)

How can I get the other positions in the simplest and quickest way? It only needs to rotate in 90 degrees increments, having 4 version (so 0, 90, 180, 270)


y), but in rotation 1 it's 5 positions from the right (x). So you need to define the newxin terms of the oldy. Putting this in more mathematical terms, we go fromy=5tox=14-5orx_new=14-y_old. Do something similar fory_newand double-check it and you have the answer. \$\endgroup\$ – Bernhard Barker yesterdayfor(x = 0; x <= n - 1; x++){ for(y = 0; y <= n - 1; y++){ plot(x,y) } }displays Rotation 0, thenfor(y = n - 1; y >= 0; y--){ for(x = 0; x <= n - 1; x++){ plot(x,y) } }will be Rotation 1. (Basically you'll notice the changes to the loops are similar to what you get in the accepted answer) \$\endgroup\$ – Kaddath yesterday