So ive been trying to make a game kinda like factorio because its my fav game right now. I’ve gotten to the point of having a global script to hold functions to add, get, and erase nodes registered to a dictionary, and to the point of having objects with different sizes, like 1x1 and 2x2. The one part I can never get right is having rotatable objects, like with a 2x1 object, for example, which never works when rotated. If anyone has done this type of thing before, plz help.
I tried making some code so I put that photo to show problems I have. I’m mainly asking if anyone else has done stuff like this, what was their method, because I can’t find anything online
I understand, but for sharing code, it’s easier if you wrap it in 3 backticks (`) like this:
```
print(“Hello world”)
```
So it’ll show up like this:
print("Hello world")
Which makes it a lot easier for you to get the help you need. Also, the screenshot of the code you shared doesn’t seem to have anything to do with the rotation.
Are all the tiles in your game separate scenes? That’s what I assumed, hence the comment about perhaps the scene not being in the center. If they aren’t could you share the full code, and elaborate how you rotated this one?
Anyway, when you are rotating your object, it seems like the pivot point is not at the centre of your object. You can fix that by setting it to the centre before rotating it, if it is a control node you can use set_pivot_offset combined with get_size() / 2 or if not make sure your scene is centered or use set_centered(true)