我正在尝试制作一个游戏,但我在这里遇到了一个小问题......我正在用箭头键移动一个图片框,以避免其他图片框......问题是,我的图片框移出了表格当我按左键太多次...我成功解决了右侧的这个问题(通过用另一个挡住图片框),但左侧版本仍然不起作用,我不知道为什么...
这是代码:
if (pictureBox7.Bounds.IntersectsWith(pictureBox1.Bounds))
switch (e.KeyCode)
{
case Keys.Escape: Application.Exit(); break;
case Keys.P: timerkunai1.Enabled = false;
timerkunai2.Enabled = false; timerkunai3.Enabled = false;
timerkunai4.Enabled = false; timerninja.Enabled = false;
timerlife.Enabled = false;
button3.Show(); break;
case Keys.Right: i = 6; dx = 25; press = true; break;
}
if (pictureBox8.Bounds.IntersectsWith(pictureBox1.Bounds))
switch (e.KeyCode)
{
case Keys.Escape: Application.Exit(); break;
case Keys.P: timerkunai1.Enabled = false;
timerkunai2.Enabled = false; timerkunai3.Enabled = false;
timerkunai4.Enabled = false; timerninja.Enabled = false;
timerlife.Enabled = false;
button3.Show(); break;
case Keys.Left: i = 0; dx = -25; press = true; break;
}
else
switch (e.KeyCode)
{
case Keys.Escape: Application.Exit(); break;
case Keys.P: timerkunai1.Enabled = false;
timerkunai2.Enabled = false; timerkunai3.Enabled = false;
timerkunai4.Enabled = false; timerninja.Enabled = false;
timerlife.Enabled = false;
button3.Show(); break;
case Keys.Left: i = 0; dx = -25; press = true; break;
case Keys.Right: i = 6; dx = 25; press = true; break;
}