如何在我的 2D 游戏中随机形成岛屿?我不知道如何开始!
void generateMap()
{
blocks.clear();
for(int x = 0; x < 150; x++)
{
for(int y = 0; y < 150; y++)
{
if(Math.random() < 0.5)
blocks.add(new Block(x * Block.blockSize, y * Block.blockSize, eBlockType.GRASS));
else
blocks.add(new Block(x * Block.blockSize, y * Block.blockSize, eBlockType.WATER));
}
}
}