I kind of figured out how to put a pause in my 2d game when the player shoots. The problem is that when the player shoots once, the game will continue to shoot continously, even after the player has stopped shooting. Can someone please help me?

        void Bullet()//draws the players ship ammo
        {
            PictureBox bullet = new PictureBox();
            bullet.SizeMode = PictureBoxSizeMode.AutoSize;
            bullet.Image = Properties.Resources.Shoot;
            bullet.BackColor = System.Drawing.Color.Transparent;
            bullet.Tag = "bullet";
            bullet.Left = playersuper.Left + 100;//moves bullet left or right
            bullet.Top = playersuper.Top + 50;//55 is perfect                    
            this.Controls.Add(bullet);
            bullet.BringToFront();
            shootimer.Interval = 1000;
            shootimer.Enabled = true;
        }
         private void shootimer_Tick(object sender, EventArgs e)
        {
            fire = new SoundPlayer("shooting.wav");
            fire.Play();
        }
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            bool playing = false;
            if (e.KeyCode == Keys.Right)
            {
                right = true;
            }
            if (e.KeyCode == Keys.Left)
            {
                left = true;
            }
            if (e.KeyCode == Keys.Up)
            {
                up = true;
            }
            if (e.KeyCode == Keys.Down)
            {
                down = true;
            }
            if (e.KeyCode == Keys.Space)
            {
                Bullet();
            }
            if (e.KeyCode == Keys.A)
            {
                if (nomissiles.Value >= 10)
                {
                    pc.miss--;
                    nomissiles.Value -= 10;
                    A = true;
                    Missile();
                }
            }
            if (e.KeyCode == Keys.Z)
            {
                PictureBox robot = new PictureBox();
                robot.SizeMode = PictureBoxSizeMode.AutoSize;
                robot.Image = Properties.Resources.Bioroidd;
                robot.BackColor = System.Drawing.Color.Transparent;
                ((PictureBox)playersuper).Image = Properties.Resources.Bioroidd;
                transform = new SoundPlayer("transforming.wav");
                transform.Play();
            }
            if (e.KeyCode == Keys.X)
            {
                PictureBox gerwalk = new PictureBox();
                gerwalk.SizeMode = PictureBoxSizeMode.AutoSize;
                gerwalk.Image = Properties.Resources.Gurwalk;
                gerwalk.BackColor = System.Drawing.Color.Transparent;
                ((PictureBox)playersuper).Image = Properties.Resources.Gurwalk;
                transform = new SoundPlayer("transforming.wav");
                transform.Play();
            }
            if (e.KeyCode == Keys.C)
            {
                PictureBox fighter = new PictureBox();
                fighter.SizeMode = PictureBoxSizeMode.StretchImage;
                fighter.Image = Properties.Resources.fighter;
                fighter.BackColor = System.Drawing.Color.Transparent;
                ((PictureBox)playersuper).Image = Properties.Resources.fighter;
                transform = new SoundPlayer("transforming.wav");
                transform.Play();
            }
            if (e.KeyCode == Keys.P)
                GameTimer.Stop();
            if (e.KeyCode == Keys.S)
                GameTimer.Start();
        }

Disregard my previous post. I figured it out after staying up all night.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.