Author Topic: Active Baseplate Generator  (Read 864 times)

I'm working on creating a minigame that uses baseplates to generate infinite terrain. I'd like it so that when you step on the baseplate that isn't completely surrounded by 2 layers of baseplates, it'll generate the missing plates. Here are some pics to help explain. I'm sorry about the quality, I didn't realize how small the images were when I made them.

The player starts on the purple square:


When the player moves to the square to the right of the purple square, the script would generate the 3 blue squares.


I'm not really sure where to begin as I'm pretty much completely new to scripting.

Talk with Port. He made this.

2D grid of bricks. Loop through each player, get their x + y position (make the tick not so often to prevent lag, you can use velocity to predict movement if you want to). Put x and y into grid positions by using modulus by the torque units of the sides of the baseplate (32x studs, 16 torque units) and then that will give you their 2D grid position. Then you just need to loop from gridX - 2 and gridY - 2 to gridX + 2 and gridY + 2 on the grid and place any bricks that don't exist.

2D grid of bricks. Loop through each player, get their x + y position (make the tick not so often to prevent lag, you can use velocity to predict movement if you want to). Put x and y into grid positions by using modulus by the torque units of the sides of the baseplate (32x studs, 16 torque units) and then that will give you their 2D grid position. Then you just need to loop from gridX - 2 and gridY - 2 to gridX + 2 and gridY + 2 on the grid and place any bricks that don't exist.
another way would be to use triggers that are automatically created at boundaries then moved right

this is just like my minecraft mod
except no minecraft, just generator