我正在尝试用 C#(windows 形式)制作一个迷你游戏,比如太空入侵者。飞船飞得很好,但我没有得到多张照片,我有一种timer_Tick
制作动画的方法,当我按空格拍摄时,第一张效果很好,但第二张效果很好。在这个半位置的第一枪消失了。镜头是pictureBox
,我尝试了 List of pictureBox
,但没有成功。
我有这样的事情:
public void Form1_Load(object sender, EventArgs e)
{
shootP = new PictureBox();
shootP.Image = Properties.Resources.shoot_1;
shootP.SizeMode = PictureBoxSizeMode.Zoom;
shootP.Size = new Size(10, 72);
ListShoot = new List<PictureBox>();
int i = -1;
}
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Space)
{
control = false;
i++;
ListShoot.Add(shootP);
timeShoot.Start();
}
private void timeShoot_Tick(object sender, EventArgs e)
{
if (control == false)
{
ListShoot[i].Location = new Point(spacecraft._imageBox.Location.X + 50, spacecraft._imageBox.Location.Y - 55); // align the shoot with spacecraft
control = true;
}
ListShoot[i].Top -= 40;
}
我究竟做错了什么?