I have this data:
[0, 0],
[-1, 0],
[1, 0],
[0, 1]
]```
I'm trying to find a way to "rotate" it around the first node, so it would become this:
```[
[-1, 0],
[0, 0],
[0, 1],
[0, -1]
]```
This is for a tetris game that uses individual "cells" to make up a block, and if I rotate the entire block, the shading on my cells gets messed up, showing that there's a light off to the side instead of above. This code turns it into the colliders and cells:
#TileData is the above mentioned array. for child in get_children(): child.queue_free() if !tileData || update_data: tileData = tileConf.data[type] for point in tileData.points: var cell = Sprite.new() cell.texture = preload("res://img/block/cell.svg") cell.modulate = tileData.color var col = CollisionShape2D.new() col.shape = preload("res://cellCollider.tres") var pos = Vector2(point[0], point[1])*36 col.position = pos col.hide() cell.position = pos add_child(col, true) add_child(cell, true)
I'm not sure this code is relevant, but maybe "rotating" them could work right in this function, and my rotation is a variable that's one, two, or three, called `turn`, because it's the best I could think of where 0 is up, 1 is left, 2 is down, 3 is right.