Cytopia icon indicating copy to clipboard operation
Cytopia copied to clipboard

[Feature] Map rotation

Open SimplyLiz opened this issue 6 years ago • 2 comments

Implement map rotation.

The mapnode matrix should be rotated in 4 positions (by 90° only).

We need to rotate the iso coordinates of the mapnodes (draw the nodes to another destionation), + the nodes it self (drawing order) and then probably run updateTextures to recalculate the destRect where the nodes are drawn

I've started to work on this at this branch: https://github.com/JimmySnails/IsometricEngine/tree/rotateMap

My approach was to rotate the whole map cell matrix, which didn't turn out the way it should have.

SimplyLiz avatar Jun 17 '18 06:06 SimplyLiz

The way I’ve handled this in OpenSC2K is to have a reference to the correct tile for each rotation within the definition of the tiles that are to be rotated. This means for a slope tile with an ID of 257, it contains a reference to the other slope tiles that coorespond to the rotated map views. In this case, the tile definition contains an array of 4 values, [257, 258, 259, 260] - one for each of the map rotation “directions, 0 through 3.

Not the most elegant solution, but it solved for some odd cases such as road/bridge tiles which only have two rotation variants instead of 4. Tiles that display the same tile in every rotation don’t have the array and are just displayed as-is on all 4 rotation variants.

nicholas-ochoa avatar Dec 31 '18 17:12 nicholas-ochoa

old branch https://github.com/CytopiaTeam/Cytopia/tree/rotateMap

Mograbi avatar Apr 17 '22 10:04 Mograbi