Anyone know a good way to rotate tetris?

Tetris is cool and I started to make it but I can’t come up with a good way to rotate the objects (besides hard coding it for each piece)

Here is the link: Flowlab Game Creator - Tetris

1 Like

add a rotation of 90 degrees

2 Likes

… play the game first (each cube is separate not combined)

it’s basically impossible to do without stupid sine and cosine calculations unless you combine them

:confused: well ima try and hard code it

trust me if you just make it all one shape not only will it be 100 times easier to code, it will also function much more optimized.

ye but i can’t because of line clearing (and when rotate i have to figure out where to spawn the blocks)

You can do that with a raycast among other calculations.

raycasts can only be sent from the center of an object + I might have come up w/ a solution
basically assing a 1-16 number then change its location when rotated (something like this image)

1 Like

Trust me just use combined blocks, you wouldn’t raycast from the blocks

1 Like

im already half way : /

1 Like

ok fine my plan was working but I accidentally made an infinite loop and I didn’t save so it all was deleted

(so ill do what u said)

1 Like

I suggest have it a single solid object, then break it apart after it lands (deleting the solid piece).

1 Like

You could research the real tetris behaviors. There must be a video explaining some of the code for the old games

Old stuff was mostly made with math and number lists.

1 Like

Are those possible in Flowlab?

For sure, though its more complicated than using the physics.

2 Likes