📄 frmmain.cs
字号:
case Keys.Left:
pbRen.Image = Lleft1.Image;
RenImage = "left1.BMP";
switch (enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 1])
{
case enumMap.地板:
JiLuUndo(enumMapArray, Undo1MapArray); Ren1Locate = pbRen.Location; 撤消ToolStripMenuItem.Enabled = true; toolStripButton5.Enabled = true;
pbRen.Left -= 30;
break;
case enumMap.箱子目地的:
JiLuUndo(enumMapArray, Undo1MapArray); Ren1Locate = pbRen.Location; 撤消ToolStripMenuItem.Enabled = true; toolStripButton5.Enabled = true;
pbRen.Left -= 30;
break;
case enumMap.箱子:
if (enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 2] == enumMap.地板)
{
JiLuUndo(enumMapArray, Undo1MapArray); Ren1Locate = pbRen.Location; 撤消ToolStripMenuItem.Enabled = true; toolStripButton5.Enabled = true;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 1]).Image = LLu.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 1] = enumMap.地板;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 2]).Image = LBox.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 2] = enumMap.箱子;
pbRen.Left -= 30;
sPushBox.Play();
break;
}
if (enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 2] == enumMap.箱子目地的)
{
JiLuUndo(enumMapArray, Undo1MapArray); Ren1Locate = pbRen.Location; 撤消ToolStripMenuItem.Enabled = true; toolStripButton5.Enabled = true;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 1]).Image = LLu.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 1] = enumMap.地板;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 2]).Image = LREDBOX.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 2] = enumMap.红箱子;
pbRen.Left -= 30;
sPushBox.Play();
}
break;
case enumMap.红箱子:
if (enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 2] == enumMap.地板)
{
JiLuUndo(enumMapArray, Undo1MapArray); Ren1Locate = pbRen.Location; 撤消ToolStripMenuItem.Enabled = true; toolStripButton5.Enabled = true;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 1]).Image = LAim.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 1] = enumMap.箱子目地的;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 2]).Image = LBox.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 2] = enumMap.箱子;
pbRen.Left -= 30;
sPushBox.Play();
break;
}
if (enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 2] == enumMap.箱子目地的)
{
JiLuUndo(enumMapArray, Undo1MapArray); Ren1Locate = pbRen.Location; 撤消ToolStripMenuItem.Enabled = true; toolStripButton5.Enabled = true;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 1]).Image = LAim.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 1] = enumMap.箱子目地的;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 2]).Image = LREDBOX.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 2] = enumMap.红箱子;
pbRen.Left -= 30;
sPushBox.Play();
}
break;
}
break;
case Keys.Right:
pbRen.Image = Lright1.Image;
RenImage = "right1.BMP";
switch (enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 1])
{
case enumMap.地板:
JiLuUndo(enumMapArray, Undo1MapArray); Ren1Locate = pbRen.Location; 撤消ToolStripMenuItem.Enabled = true; toolStripButton5.Enabled = true;
pbRen.Left += 30;
break;
case enumMap.箱子目地的:
JiLuUndo(enumMapArray, Undo1MapArray); Ren1Locate = pbRen.Location; 撤消ToolStripMenuItem.Enabled = true; toolStripButton5.Enabled = true;
pbRen.Left += 30;
break;
case enumMap.箱子:
if (enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 2] == enumMap.地板)
{
JiLuUndo(enumMapArray, Undo1MapArray); Ren1Locate = pbRen.Location; 撤消ToolStripMenuItem.Enabled = true; toolStripButton5.Enabled = true;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 1]).Image = LLu.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 1] = enumMap.地板;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 2]).Image = LBox.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 2] = enumMap.箱子;
pbRen.Left += 30;
sPushBox.Play();
break;
}
if (enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 2] == enumMap.箱子目地的)
{
JiLuUndo(enumMapArray, Undo1MapArray); Ren1Locate = pbRen.Location; 撤消ToolStripMenuItem.Enabled = true; toolStripButton5.Enabled = true;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 1]).Image = LLu.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 1] = enumMap.地板;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 2]).Image = LREDBOX.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 2] = enumMap.红箱子;
pbRen.Left += 30;
sPushBox.Play();
}
break;
case enumMap.红箱子:
if (enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 2] == enumMap.地板)
{
JiLuUndo(enumMapArray, Undo1MapArray); Ren1Locate = pbRen.Location; 撤消ToolStripMenuItem.Enabled = true; toolStripButton5.Enabled = true;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 1]).Image = LAim.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 1] = enumMap.箱子目地的;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 2]).Image = LBox.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 2] = enumMap.箱子;
pbRen.Left += 30;
sPushBox.Play();
break;
}
if (enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 2] == enumMap.箱子目地的)
{
JiLuUndo(enumMapArray, Undo1MapArray); Ren1Locate = pbRen.Location; 撤消ToolStripMenuItem.Enabled = true; toolStripButton5.Enabled = true;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 1]).Image = LAim.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 1] = enumMap.箱子目地的;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 2]).Image = LREDBOX.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 2] = enumMap.红箱子;
pbRen.Left += 30;
sPushBox.Play();
}
break;
}
break;
case Keys.Up:
pbRen.Image = Lup1.Image;
RenImage = "up1.BMP";
switch (enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 15])
{
case enumMap.地板:
JiLuUndo(enumMapArray, Undo1MapArray); Ren1Locate = pbRen.Location; 撤消ToolStripMenuItem.Enabled = true; toolStripButton5.Enabled = true;
pbRen.Top -= 30;
break;
case enumMap.箱子目地的:
JiLuUndo(enumMapArray, Undo1MapArray); Ren1Locate = pbRen.Location; 撤消ToolStripMenuItem.Enabled = true; toolStripButton5.Enabled = true;
pbRen.Top -= 30;
break;
case enumMap.箱子:
if (enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 30] == enumMap.地板)
{
JiLuUndo(enumMapArray, Undo1MapArray); Ren1Locate = pbRen.Location; 撤消ToolStripMenuItem.Enabled = true; toolStripButton5.Enabled = true;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 15]).Image = LLu.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 15] = enumMap.地板;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 30]).Image = LBox.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 30] = enumMap.箱子;
pbRen.Top -= 30;
sPushBox.Play();
break;
}
if (enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 30] == enumMap.箱子目地的)
{
JiLuUndo(enumMapArray, Undo1MapArray); Ren1Locate = pbRen.Location; 撤消ToolStripMenuItem.Enabled = true; toolStripButton5.Enabled = true;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 15]).Image = LLu.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 15] = enumMap.地板;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 30]).Image = LREDBOX.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 30] = enumMap.红箱子;
pbRen.Top -= 30;
sPushBox.Play();
}
break;
case enumMap.红箱子:
if (enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 30] == enumMap.地板)
{
JiLuUndo(enumMapArray, Undo1MapArray); Ren1Locate = pbRen.Location; 撤消ToolStripMenuItem.Enabled = true; toolStripButton5.Enabled = true;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 15]).Image = LAim.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 15] = enumMap.箱子目地的;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 30]).Image = LBox.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 30] = enumMap.箱子;
pbRen.Top -= 30;
sPushBox.Play();
break;
}
if (enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 30] == enumMap.箱子目地的)
{
JiLuUndo(enumMapArray, Undo1MapArray); Ren1Locate = pbRen.Location; 撤消ToolStripMenuItem.Enabled = true; toolStripButton5.Enabled = true;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 15]).Image = LAim.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 15] = enumMap.箱子目地的;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 30]).Image = LREDBOX.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 - 30] = enumMap.红箱子;
pbRen.Top -= 30;
sPushBox.Play();
}
break;
}
break;
case Keys.Down:
pbRen.Image = Ldown1.Image;
RenImage = "down1.BMP";
switch (enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 15])
{
case enumMap.地板:
JiLuUndo(enumMapArray, Undo1MapArray); Ren1Locate = pbRen.Location; 撤消ToolStripMenuItem.Enabled = true; toolStripButton5.Enabled = true;
pbRen.Top += 30;
break;
case enumMap.箱子目地的:
JiLuUndo(enumMapArray, Undo1MapArray); Ren1Locate = pbRen.Location; 撤消ToolStripMenuItem.Enabled = true; toolStripButton5.Enabled = true;
pbRen.Top += 30;
break;
case enumMap.箱子:
if (enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 30] == enumMap.地板)
{
JiLuUndo(enumMapArray, Undo1MapArray); Ren1Locate = pbRen.Location; 撤消ToolStripMenuItem.Enabled = true; toolStripButton5.Enabled = true;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 15]).Image = LLu.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 15] = enumMap.地板;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 30]).Image = LBox.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 30] = enumMap.箱子;
pbRen.Top += 30;
sPushBox.Play();
break;
}
if (enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 30] == enumMap.箱子目地的)
{
JiLuUndo(enumMapArray, Undo1MapArray); Ren1Locate = pbRen.Location; 撤消ToolStripMenuItem.Enabled = true; toolStripButton5.Enabled = true;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 15]).Image = LLu.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 15] = enumMap.地板;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 30]).Image = LREDBOX.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 30] = enumMap.红箱子;
pbRen.Top += 30;
sPushBox.Play();
}
break;
case enumMap.红箱子:
if (enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 30] == enumMap.地板)
{
JiLuUndo(enumMapArray, Undo1MapArray); Ren1Locate = pbRen.Location; 撤消ToolStripMenuItem.Enabled = true; toolStripButton5.Enabled = true;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 15]).Image = LAim.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 15] = enumMap.箱子目地的;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 30]).Image = LBox.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 30] = enumMap.箱子;
pbRen.Top += 30;
sPushBox.Play();
break;
}
if (enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 30] == enumMap.箱子目地的)
{
JiLuUndo(enumMapArray, Undo1MapArray); Ren1Locate = pbRen.Location; 撤消ToolStripMenuItem.Enabled = true; toolStripButton5.Enabled = true;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 15]).Image = LAim.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 15] = enumMap.箱子目地的;
((PictureBox)MapArrayList[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 30]).Image = LREDBOX.Image;
enumMapArray[pbRen.Top / 30 * 15 + pbRen.Left / 30 + 30] = enumMap.红箱子;
pbRen.Top += 30;
sPushBox.Play();
}
break;
}
break;
}
if (WinBool())
{
Sound s = new Sound(this);
s.Load(Application.StartupPath + "\\Win.WAV");
s.Play();
MessageBox.Show("恭喜你已通过了第【★-" + Level.ToString() + "-★】关!\n请继续。。。", "推箱子", MessageBoxButtons.OK, MessageBoxIcon.Information);
下一关NToolStripMenuItem_Click(null, null);
return;
}
if (lcation == pbRen.Location && (e.KeyCode == Keys.Left || e.KeyCode == Keys.Right || e.KeyCode == Keys.Up || e.KeyCode == Keys.Down)) sCantBox.Play();
}
private void 下一关NToolStripMenuItem_Click(object sender, EventArgs e)
{
timer1.Enabled = false;
if (File.Exists(Application.StartupPath + "\\Level\\Level" + (Level + 1).ToString() + ".hmap"))
{
Level++;
}
ShowMap("Level" + Level.ToString() + ".hmap");
}
private void 上一关PToolStripMenuItem_Click(object sender, EventArgs e)
{
timer1.Enabled = false;
if (File.Exists(Application.StartupPath + "\\Level\\Level" + (Level - 1).ToString() + ".hmap"))
{
Level--;
}
ShowMap("Level" + Level.ToString() + ".hmap");
}
private void 设计新游戏ToolStripMenuItem_Click(object sender, EventArgs e)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -