【发布时间】:2012-04-14 00:20:12
【问题描述】:
我正在为一个项目制作俄罗斯方块克隆。我几乎完成了,但我的清晰线条课程有一个我无法摆脱的错误。我制作了一个 10*20 的网格,将精灵绘制到其中。当我在地板上找到一条线时,它可以正常工作,但在此之上它只会删除该线并将其下方的所有内容也向下移动。这是我的 clear line 类的代码:
public static void ClearLines()
{
for (int CountY = Game1.LandedBlocks.GetLength(1) - 1; CountY >= 0; CountY--)
{
bool clearLine = true;
for (int CountX = 0; CountX < Game1.LandedBlocks.GetLength(0); CountX++)
{
clearLine &= Game1.LandedBlocks[CountX, CountY] != -1;
}
if (clearLine)
{
for (int CountX = 0; CountX < Game1.LandedBlocks.GetLength(0); CountX++)
{
Game1.LandedBlocks[CountX, CountY] = -1;
}
for (int y = Game1.LandedBlocks.GetLength(1) - 1; y > 0; y--)
{
for (int CountX = 0; CountX < Game1.LandedBlocks.GetLength(0); CountX++)
{
Game1.LandedBlocks[CountX, y] = Game1.LandedBlocks[CountX, y - 1];
}
}
CountY++;
Game1.rows++;
Game1.score += 100;
}
}
}
如果有人能说明该怎么做,我将不胜感激。我已经尝试了很多,但没有任何效果:(
【问题讨论】:
-
对该类的格式感到抱歉。当我查看帖子时被格式化
-
我刚刚整理出来,只需要等待批准
-
我刚刚编辑了它,希望很快就会好起来。
-
请标记您使用的语言。 (真的有一个 [俄罗斯方块] 标签?boggles)
-
@Wooble:你可以输入任何你喜欢的标签。