Firstly, I will quickly explain how my game would work.
You can place machines and conveyors and connect them to move stuff around and process them. What you can do when placing the machines is rotate them (I’m not inventing the wheel)
How I would try to do it is have a table of all the space grid.
For example purposes, X is an occupied spaces by the machine, O is a free space and P is the placing point and from where it rotates
{O, O, O, O, O,
O, O, O, O, O,
O, O, O, O, O, means that every space is empty and unoccupied, so you can
O, O, O, O, O, place anything anywhere basically.
O, O, O, O, O}
Now, I have a table of every machine’s space in a module like that
{X, O, X,
X, P, X}
The checks for collision and things like that should be easy, I know what to do. What I’m worried about is how to rotate it from the placing point. (P if you have paid attention)
Going from this:
{O, O, O, O, O,
O, X, O, X, O
O, X, P, X, O
O, O, O, O, O,
O, O, O, O, O}
To this:
{O, O, O, O, O,
O, O, X, X, O,
O, O, P, O, O,
O, O, X, X, O,
O, O, O, O, O}
So, how would I go around to doing that? Should I just make 4 variations of every machines for every 90 degree turns or is there some clever code?
If you want more information about how I’m gonna do it to help the issue further, I can share more information about the details.
Any response is appreciated because last time I had no real answers. Thanks again!