Learning C# and I am working on a C# scrolling shooting game. The game works so far but when the player finishes a level, I want the enemies to appear on the far right of the screen and the player on the left of the screen. When the level is finished neither the enemies or the player appear. Can someone please help me?

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Media;
using WMPLib;
namespace Macross_mod_8
{
    public partial class Game : Form
    {
        WindowsMediaPlayer win = new WindowsMediaPlayer();
        WindowsMediaPlayer Roy = new WindowsMediaPlayer();
        WindowsMediaPlayer Rick = new WindowsMediaPlayer();
        WindowsMediaPlayer squad = new WindowsMediaPlayer();
        WindowsMediaPlayer alien = new WindowsMediaPlayer();
        WindowsMediaPlayer fly = new WindowsMediaPlayer();
        playerclass pc = new playerclass();
        LevelClass lc = new LevelClass();
        private SoundPlayer pl = new SoundPlayer();
        private SoundPlayer fire;
        private SoundPlayer transform;
        private SoundPlayer victory;
        //private SoundPlayer dead;
        private SoundPlayer theme = new SoundPlayer();
        int num = 0;//used to count images for imagelist
        int no = 0;//used to count images for imagelist
        bool right, left, up, down, space, Z, X, C, A;
        int score;//this will run as long as the player has lives and doesn't die
        int fscore;
        int kills;//how many enemies player killed in the game
        int miss = 10;// number of missiles player has
        int m = 0;//Counts how many missiles have been used by the player
        int i = 0;//used for healing square
        int xp = 0;//number used to count for explosions
        private int _ticks;// You use a private variable when you want to do some sort of validation 
        //before setting the property, or basically abstract away what is happening inside your 
        //class with regards to that property

        private int nlevel;//This wil show what level the player is on
        private int endlevel;//this will count off the time from victory song and the player sprite reaches far right wall

        Random rnd = new Random();
        private int objwidth;
        private const int objheight = 50;
        private int objx, objy;//position
        private int volx, voly;//velocity
        public Game()
        {
            InitializeComponent();
            armouredPlayer.Visible = false;
            playersuper.Visible = false;
            walking.Visible = true;
            shooting.Visible = true;
            //this.theme.SoundLocation = @"C:\Users\abgarza003\Documents\C# stuff\Macross mod 8\Macross mod 8\bin\Debug\Robotech Theme.wav";
            this.theme.PlayLooping();
            lblchoose.Visible = true;
            lblready.Visible = false;
            lblgo.Visible = false;
            lblgameover.Visible = false;
            lblyoukilled.Visible = false;
            lblkilled.Visible = false;
            lblenemies.Visible = false;
            lblready.Visible = false;
            lblgo.Visible = false;
            lblfinalpoints.Visible = false;
            //lblfinalscore.Visible = false;
            lblscoreforlevel.Visible = false;
            enemyhealth.Visible = false;
            lblbosshealth.Visible = false;
            GameTimer.Stop();
            kills++;
            mplayer.Visible = false;
            e9laser.Visible = false;
            powerarmour.Visible = false;
            zmissile1.Visible = false;
            zmissile2.Visible = false;
            zmissile3.Visible = false;
            lblscore.Visible = true;
            officers.Visible = false;
            level1.Visible = true;
            level2.Visible = false;
            level3.Visible = false;
        }
        void GameScore()
        {
            score++;
            lblscore.Text = "" + score;
        }
        void AutoMovePlayer()
        {
            //This will move the player across the screen after the boss is beaten
            //lblscore = lblfinalscore;
            endlevel++;
            GameTimer.Enabled = true;
            enemyhealth.Visible = false;
            lblbosshealth.Visible = false;
            playersuper.Left = playersuper.Left + 20;
            if (playersuper.Left >= 1400)
            {
                enemyhealth.Visible = false;
                lblbosshealth.Visible = false;
                lblfinalpoints.Visible = true;
                GameTimer.Enabled = false;
                lblscoreforlevel.Visible = true;
                lblfinalpoints.Text = "" + score;//displays current score
            }
            armouredPlayer.Left = armouredPlayer.Left + 20;
            if(armouredPlayer.Left > 1400)
            {
                enemyhealth.Visible = false;
                lblbosshealth.Visible = false;
                lblfinalpoints.Visible = true;
                GameTimer.Enabled = false;
                lblscoreforlevel.Visible = true;
                lblfinalpoints.Text = "" + score;//displays current score
            }
            /*
            if(endlevel > 250 && armouredPlayer.Visible || endlevel > 250 && playersuper.Visible)
            {
                mplayer.close();
                //NextLevel();//
            }
            */
        }
        private void finaletimer_Tick(object sender, EventArgs e)
        {
            if (enemyhealth.Value <= 0)
            {
                bouncingtimer.Stop();
                lblkilled.Text = "" + kills;//shows how many enemies player killed
                AutoMovePlayer();
            }
        }
        void GameLevel()
        {
            if (lc.nlevel > 0)
                lc.nlevel -= 1;
            if(lc.nlevel == 2)
            {
                level1.Visible = true;
                level2.Visible = true;
                level3.Visible = false;
            }
            if(lc.nlevel == 1)
            {
                level1.Visible = true;
                level2.Visible = true;
                level3.Visible = true;

            }
        }
        void Lives()
        {
            if (pc.Plives > 0)
                pc.Plives -= 1;
            if (pc.Plives == 3)
            {
                life1.Visible = true;
                life2.Visible = true;
                life3.Visible = true;            }
            else if (pc.Plives == 2)
            {
                life1.Visible = false;
                life2.Visible = true;
                life3.Visible = true;
                ResetGameAfterDeath();
                //RandomQuotes();
            }
            else if (pc.Plives == 1)
            {
                life1.Visible = false;
                life2.Visible = false;
                life3.Visible = true;
                ResetGameAfterDeath();
                //RandomQuotes();
            }
            else if (pc.Plives == 0)
            {
                life1.Visible = false;
                life2.Visible = false;
                life3.Visible = false;
                mplayer.close();
            }
        }
        private void timer1_Tick(object sender, EventArgs e)
        {
            lblready.Visible = false;
            lblgo.Visible = false;
            timer1.Enabled = false;
        }
        void NextLevel()
        //When player dies enemies reset to x1300 and will randomlly be placed between y30 to y560
        {
            //GameTimer.Start();
            //GameTimer.Enabled = true;
            int a, b, c, d, e, f, g, h;
            //armouredPlayer.Location = new Point(0, 250); //(-100, -300);
            //playersuper.Location = new Point(0, 250);
            a = rnd.Next(30, 560);
            b = rnd.Next(30, 560);
            c = rnd.Next(30, 560);
            d = rnd.Next(30, 560);
            e = rnd.Next(30, 560);
            f = rnd.Next(30, 560);
            g = rnd.Next(30, 560);
            h = rnd.Next(30, 560);
            e1.Location = new Point(1300, a);
            e2.Location = new Point(1300, b);
            e3.Location = new Point(1300, c);
            e4.Location = new Point(1300, d);
            e5.Location = new Point(1300, e);
            e6.Location = new Point(1300, f);
            e7.Location = new Point(1300, g);
            e8.Location = new Point(1300, h);
            lblready.Visible = false;
            lblgo.Visible = false;
        }
        void ResetGameAfterDeath()
        //When player dies enemies reset to x1300 and will randomlly be placed between y30 to y560
        {
            int a, b, c, d, e, f, g, h;
            armouredPlayer.Location = new Point(0, 250); //(-100, -300);
            playersuper.Location = new Point(0, 250);
            a = rnd.Next(30, 560);
            b = rnd.Next(30, 560);
            c = rnd.Next(30, 560);
            d = rnd.Next(30, 560);
            e = rnd.Next(30, 560);
            f = rnd.Next(30, 560);
            g = rnd.Next(30, 560);
            h = rnd.Next(30, 560);
            e1.Location = new Point(1300, a);
            e2.Location = new Point(1300, b);
            e3.Location = new Point(1300, c);
            e4.Location = new Point(1300, d);
            e5.Location = new Point(1300, e);
            e6.Location = new Point(1300, f);
            e7.Location = new Point(1300, g);
            e8.Location = new Point(1300, h);
            lblready.Visible = true;
            lblgo.Visible = true;
            //mad.Visible = true;
            //RandomQuotes();
            timer1.Interval = 1000;
            timer1.Enabled = true;
        }
        void HitorMiss()
        //function handles collision with enemies, player shooting and hitting enemies
        //enemies hitting player, player touches heal symbol and player death
        {
            foreach (Control j in this.Controls)
            {
                if (j is PictureBox && (j.Tag == "bullet" || j.Tag == "missile"))
                {
                    foreach (Control i in Controls)
                    {
                        if (i is PictureBox && i.Tag == "boss")
                        {
                            if (j.Bounds.IntersectsWith(i.Bounds))
                            {
                                if (enemyhealth.Value <= 0)
                                {
                                    i.Top = -750;
                                    mplayer.close();
                                    PictureBox shoot = new PictureBox();
                                    shoot.SizeMode = PictureBoxSizeMode.AutoSize;
                                    shoot.Image = Properties.Resources.Shoot;
                                    shoot.BackColor = System.Drawing.Color.Transparent;
                                    ((PictureBox)j).Image = Properties.Resources.explosion;
                                    nomissiles.Value = 100;
                                    healthbar.Value = 100;
                                    nomissiles.Value = 100;
                                    healthbar.Value = 100;
                                    playersuper.Location = new Point(0, 250);
                                    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();
                                    nmissiles.Visible = false;
                                    healthup.Visible = false;
                                    enemyhealth.Visible = false;
                                    lblbosshealth.Visible = false;
                                    victory = new SoundPlayer("victory.wav");
                                    victory.Play();
                                    fly.URL = "gundam_soaring_by.mp3";
                                    fly.controls.play();
                                    nomissiles.Value = 100;
                                    healthbar.Value = 100;
                                    nomissiles.Value = 100;
                                    healthbar.Value = 100;
                                    GameScore();
                                    GameLevel();
                                    powerarmour.Visible = false;
                                    e9laser.Visible = false;
                                    powerarmour.Location = new Point(-250, -50);//
                                    e9laser.Location = new Point(-150, 50);  //(1250,50);
                                    boom.Visible = false;
                                    boom1.Visible = false;
                                    boom2.Visible = false;
                                    boom3.Visible = false;
                                    boom4.Visible = false;
                                    boom5.Visible = false;
                                    lblyoukilled.Visible = true;
                                    lblkilled.Visible = true;
                                    lblenemies.Visible = true; 
                                }
                                else
                                    enemyhealth.Value -= 5;
                            }
                        }
                        //if (i is PictureBox && i.Tag == "enemies")
                        if (i is PictureBox && (i.Tag == "enemies" || i.Tag == "zmissile"))
                        {
                            if (j.Bounds.IntersectsWith(i.Bounds))
                            {
                                i.Top = -750;//100;
                                PictureBox bullet = new PictureBox();
                                bullet.SizeMode = PictureBoxSizeMode.AutoSize;
                                bullet.Image = Properties.Resources.Shoot;
                                bullet.BackColor = System.Drawing.Color.Transparent;
                                ((PictureBox)j).Image = Properties.Resources.explosion;
                                kills++;
                                e8laser.Location = new Point(-150, 50);  //(1250,50);
                                //score++;//each time an enemy dies score goes up one point
                                //lblscore.Text = "" + score;//displays current score    
                            }
                        }
                    }
                }
            }
            if (armouredPlayer.Bounds.IntersectsWith(healthup.Bounds))//heals player
            {
                healthbar.Value = 100;
            }
            if (armouredPlayer.Bounds.IntersectsWith(nmissiles.Bounds))//refills players missiles
            {
                nomissiles.ForeColor = Color.Red;
                nomissiles.Value = 100;
            }
            _ticks++;
            /*
            if(_ticks > 300)//2180
            {
                mplayer.URL = "Rick Hunter Theme.mp3";
            }
            */
            if (_ticks > 100)//2180 which is the length of we will win
            {
                //this function controls boss movement
                //BossMove();
                enemyhealth.Visible = true;
                powerarmour.Visible = true;
                lblbosshealth.Visible = true;
                e9laser.Visible = true;
                zmissile1.Visible = true;
                zmissile2.Visible = true;
                zmissile3.Visible = true;
                e1.Location = new Point(-150, 50);  //(1250,50);
                e2.Location = new Point(-150, 75);// (1250,75);
                e3.Location = new Point(-150, 180);// (1250, 100);
                e4.Location = new Point(-150, 125);// (1250,125);
                e5.Location = new Point(-150, 135);// (1250,135);
                e6.Location = new Point(-150, 140);// (1250,140);
                e7.Location = new Point(-150, 145);// (1250,145);
                e8.Location = new Point(-150, 150);
                e1laser.Visible = false;
                e2laser.Visible = false;
                e3laser.Visible = false;
                e4laser.Visible = false;
                e5laser.Visible = false;
                e6laser.Visible = false;
                e7laser.Visible = false;
                e8laser.Visible = false;
                if (playersuper.Bounds.IntersectsWith(powerarmour.Bounds) || playersuper.Bounds.IntersectsWith(e9laser.Bounds) || playersuper.Bounds.IntersectsWith(zmissile1.Bounds) || playersuper.Bounds.IntersectsWith(zmissile2.Bounds) || playersuper.Bounds.IntersectsWith(zmissile3.Bounds))
                {
                    //Player loses health when hit by boss laser or touches powerarmour body
                    if (healthbar.Value <= 0)
                    {
                        Lives();
                        healthbar.Value = 100;
                    }
                    if (pc.Plives == 0)
                    {
                        Lives();
                        GameTimer.Stop();
                        /////////////////////player.close();
                        lblgameover.Visible = true;
                        lblgameover.Text = "GAME OVER";
                        PictureBox bullet = new PictureBox();
                        bullet.SizeMode = PictureBoxSizeMode.AutoSize;
                        bullet.Image = Properties.Resources.Shoot;
                        bullet.BackColor = System.Drawing.Color.Transparent;
                        ((PictureBox)playersuper).Image = Properties.Resources.explosion;

                        //dead = new SoundPlayer("death.wav");
                        //RandomQuotes();
                        //dead.Play();
                        this.pl.SoundLocation = @"C:\Users\abgarza003\Documents\C# stuff\Macross mod 6\Macross mod 6\bin\Debug\Dead.wav";
                        this.pl.PlayLooping();
                    }
                    else
                    {
                        healthbar.Value -= 10;
                    }
                }
            }
            if (playersuper.Bounds.IntersectsWith(e1.Bounds) || playersuper.Bounds.IntersectsWith(e1laser.Bounds) || playersuper.Bounds.IntersectsWith(e2.Bounds) || playersuper.Bounds.IntersectsWith(e2laser.Bounds) || playersuper.Bounds.IntersectsWith(e3.Bounds) || playersuper.Bounds.IntersectsWith(e3laser.Bounds) || playersuper.Bounds.IntersectsWith(e4.Bounds) || playersuper.Bounds.IntersectsWith(e4laser.Bounds) || playersuper.Bounds.IntersectsWith(e5.Bounds) || armouredPlayer.Bounds.IntersectsWith(e5laser.Bounds) || playersuper.Bounds.IntersectsWith(e6.Bounds) || playersuper.Bounds.IntersectsWith(e6laser.Bounds) || playersuper.Bounds.IntersectsWith(e7.Bounds) || playersuper.Bounds.IntersectsWith(e7laser.Bounds) || playersuper.Bounds.IntersectsWith(e8.Bounds) || playersuper.Bounds.IntersectsWith(e8laser.Bounds))
            {
                if (healthbar.Value <= 0)
                {
                    Lives();
                    healthbar.Value = 100;
                }
                if (pc.Plives == 0)
                {
                    Lives();
                    GameTimer.Stop();
                    //bouncingtimer.Stop();
                    /////////////////////player.close();
                    lblgameover.Visible = true;
                    lblgameover.Text = "GAME OVER";
                    PictureBox bullet = new PictureBox();
                    bullet.SizeMode = PictureBoxSizeMode.AutoSize;
                    bullet.Image = Properties.Resources.Shoot;
                    bullet.BackColor = System.Drawing.Color.Transparent;
                    ((PictureBox)playersuper).Image = Properties.Resources.explosion;
                    //dead = new SoundPlayer("death.wav");
                    //RandomQuotes();
                    //dead.Play();
                    this.pl.SoundLocation = @"C:\Users\abgarza003\Documents\C# stuff\Macross mod 6\Macross mod 6\bin\Debug\Dead.wav";
                    this.pl.PlayLooping();
                }
                else
                    healthbar.Value -= 10;
            }
            if (armouredPlayer.Bounds.IntersectsWith(e1.Bounds) || armouredPlayer.Bounds.IntersectsWith(e1laser.Bounds) || armouredPlayer.Bounds.IntersectsWith(e2.Bounds) || armouredPlayer.Bounds.IntersectsWith(e2laser.Bounds) || armouredPlayer.Bounds.IntersectsWith(e3.Bounds) || armouredPlayer.Bounds.IntersectsWith(e3laser.Bounds) || armouredPlayer.Bounds.IntersectsWith(e4.Bounds) || armouredPlayer.Bounds.IntersectsWith(e4laser.Bounds) || armouredPlayer.Bounds.IntersectsWith(e5.Bounds) || armouredPlayer.Bounds.IntersectsWith(e5laser.Bounds) || armouredPlayer.Bounds.IntersectsWith(e6.Bounds) || armouredPlayer.Bounds.IntersectsWith(e6laser.Bounds) || armouredPlayer.Bounds.IntersectsWith(e7.Bounds) || armouredPlayer.Bounds.IntersectsWith(e7laser.Bounds) || armouredPlayer.Bounds.IntersectsWith(e8.Bounds) || armouredPlayer.Bounds.IntersectsWith(e8laser.Bounds))
            {
                if (healthbar.Value <= 0)
                {
                    Lives();
                    healthbar.Value = 100;
                }
                if (pc.Plives == 0)
                {
                    Lives();
                    GameTimer.Stop();
                    //bouncingtimer.Stop();
                    /////////////////////player.close();
                    lblgameover.Visible = true;
                    lblgameover.Text = "GAME OVER";
                    PictureBox bullet = new PictureBox();
                    bullet.SizeMode = PictureBoxSizeMode.AutoSize;
                    bullet.Image = Properties.Resources.Shoot;
                    bullet.BackColor = System.Drawing.Color.Transparent;
                    ((PictureBox)armouredPlayer).Image = Properties.Resources.explosion;
                    //dead = new SoundPlayer("death.wav");
                    //RandomQuotes();
                    //dead.Play();
                    this.pl.SoundLocation = @"C:\Users\abgarza003\Documents\C# stuff\Macross mod 6\Macross mod 6\bin\Debug\Dead.wav";
                    this.pl.PlayLooping();
                }
                else
                    healthbar.Value -= 10;
            }
        }
        void Explosion()
        {
            Random rnd = new Random();
            int a = rnd.Next(0, 1200);//690
            int b = rnd.Next(0, 650);//600
            int c = rnd.Next(0, 1200);//690
            int d = rnd.Next(0, 650);//600
            int e = rnd.Next(0, 1200);//690
            int f = rnd.Next(0, 650);//600
            int g = rnd.Next(0, 1200);//690
            int h = rnd.Next(0, 650);//600
            int i = rnd.Next(0, 1200);//690
            int j = rnd.Next(0, 650);//600
            int k = rnd.Next(0, 1200);//690
            int l = rnd.Next(0, 650);//600
            boom.Image = imageList3.Images[xp];
            boom.Location = new Point(a, b);
            if (xp == imageList3.Images.Count - 1)
            {
                xp = 0;
            }
            else
            {
                xp++;
            }
            boom1.Image = imageList3.Images[xp];
            boom1.Location = new Point(c, d);
            if (xp == imageList3.Images.Count - 1)
            {
                xp = 0;
            }
            else
            {
                xp++;
            }
            boom2.Image = imageList3.Images[xp];
            boom2.Location = new Point(e, f);
            if (xp == imageList3.Images.Count - 1)
            {
                xp = 0;
            }
            else
            {
                xp++;
            }
            boom3.Image = imageList3.Images[xp];
            boom3.Location = new Point(g, h);
            if (xp == imageList3.Images.Count - 1)
            {
                xp = 0;
            }
            else
            {
                xp++;
            }
            boom4.Image = imageList3.Images[xp];
            boom4.Location = new Point(i, j);
            if (xp == imageList3.Images.Count - 1)
            {
                xp = 0;
            }
            else
            {
                xp++;
            }
            boom5.Image = imageList3.Images[xp];
            boom5.Location = new Point(k, l);
            if (xp == imageList3.Images.Count - 1)
            {
                xp = 0;
            }
            else
            {
                xp++;
            }
        }
        private void Game_KeyDown(object sender, KeyEventArgs e)
        {
            if (enemyhealth.Value == 0)
            {
                if (e.KeyCode == Keys.Right)
                {
                    right = false;
                }
                if (e.KeyCode == Keys.Left)
                {
                    left = false;
                }
                if (e.KeyCode == Keys.Up)
                {
                    up = false;
                }
                if (e.KeyCode == Keys.Down)
                {
                    down = false;
                }
                if (e.KeyCode == Keys.Space)
                {
                    space = false;
                    //Bullet();
                    //fire = new SoundPlayer("shooting.wav");
                    //fire.Play();
                }
                if (e.KeyCode == Keys.A)
                {
                    A = false;
                    //Missile();
                    if (nomissiles.Value >= 10)
                    {
                        /*
                        miss--;
                        nomissiles.Value -= 10;
                        A = false;
                        Missile();
                        */
                    }
                }
                if (e.KeyCode == Keys.P)
                    GameTimer.Stop();
                if (e.KeyCode == Keys.S)
                    GameTimer.Start();
            }
            else
            {
                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)
                {
                    space = true;
                    Bullet();
                    fire = new SoundPlayer("shooting.wav");
                    fire.Play();
                }
                if (e.KeyCode == Keys.A)
                {
                    if (nomissiles.Value >= 10)
                    {
                        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();
            }
        }
        void Enemies_move()
        {
            int a, b, c, d, e, f, g, h;
            Random rnd = new Random();
            e1.Left -= 15;// 10;//1053
            if (e1.Left < 0)
            {
                a = rnd.Next(30, 560);
                e1.Location = new Point(1300, a);
            }
            e2.Left -= 15;// 10;
            if (e2.Left < 0)
            {

                b = rnd.Next(30, 560);
                e2.Location = new Point(1300, b);
            }
            e3.Left -= 15;// 10;
            if (e3.Left < 0)//if (e3.Left < 0)
            {
                c = rnd.Next(30, 560);
                e3.Location = new Point(1300, c);
            }
            e4.Left -= 15;// 10;
            if (e4.Left < 0)
            {
                d = rnd.Next(30, 560);
                e4.Location = new Point(1300, d);
            }
            e5.Left -= 15;// 10;
            if (e5.Left < 0)
            {
                e = rnd.Next(30, 560);
                e5.Location = new Point(1300, e);
            }
            e6.Left -= 15;
            if (e6.Left < 0)
            {
                f = rnd.Next(30, 560);
                e6.Location = new Point(1300, f);
            }
            e7.Left -= 15;
            if (e7.Left < 0)
            {
                g = rnd.Next(30, 560);
                e7.Location = new Point(3200, g);
            }
            e8.Left -= 15;
            if (e8.Left < 0)
            {
                h = rnd.Next(30, 560);
                e8.Location = new Point(3200, h);
            }
        }
        void Bullet()//draws super veretech players 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();
        }
        void movebullet()
        {
            foreach (Control x in this.Controls)
            {
                if (x is PictureBox && x.Tag == "bullet")
                {
                    x.Left += 100;//x.Top -= 10;
                    if (x.Top > 900)//<100
                    {
                        this.Controls.Remove(x);
                    }
                }
            }
        }
        void EnemymoveBullet()
        {//This handles the enemies shooting at player
            e1laser.Left -= 100;
            if (e1laser.Left < 0)
            {
                e1laser.Left = e1.Left;
                e1laser.Top = e1.Top + 25;
            }
            e2laser.Left -= 100;
            if (e2laser.Left < 0)
            {
                e2laser.Left = e2.Left;
                e2laser.Top = e2.Top + 25;
            }
            e3laser.Left -= 100;
            if (e3laser.Left < 0)
            {
                e3laser.Left = e3.Left;
                e3laser.Top = e3.Top + 25;
            }
            e4laser.Left -= 100;
            if (e4laser.Left < 0)
            {
                e4laser.Left = e4.Left;
                e4laser.Top = e4.Top + 25;
            }
            e5laser.Left -= 100;
            if (e5laser.Left < 0)
            {
                e5laser.Left = e5.Left;
                e5laser.Top = e5.Top + 25;
            }
            e6laser.Left -= 100;
            if (e6laser.Left < 0)
            {
                e6laser.Left = e6.Left;
                e6laser.Top = e6.Top + 25;
            }
            e7laser.Left -= 100;
            if (e7laser.Left < 0)
            {
                e7laser.Left = e7.Left;
                e7laser.Top = e7.Top + 25;
            }
            e8laser.Left -= 100;//30
            if (e8laser.Left < 0)
            {
                e8laser.Left = e8.Left;
                e8laser.Top = e8.Top + 25;//25 moves laser up and down y axis
            }
            e9laser.Left -= 100;
            if (e9laser.Left < 0)
            {
                e9laser.Left = powerarmour.Left;
                e9laser.Top = powerarmour.Top + 60;
            }
            zmissile1.Left = zmissile1.Left -= 40;
            zmissile1.Top = zmissile1.Top - 40;
            if (zmissile1.Left < 0)
            {
                zmissile1.Left = powerarmour.Left;
                zmissile1.Top = powerarmour.Top + 10;//+10
            }
            zmissile2.Left -= 40;
            if (zmissile2.Left < 0)
            {
                zmissile2.Left = powerarmour.Left;
                zmissile2.Top = powerarmour.Top + 50;//+10
            }
            zmissile3.Left = zmissile3.Left -= 40;
            zmissile3.Top = zmissile3.Top + 40;
            if (zmissile3.Left < 0)
            {
                zmissile3.Left = powerarmour.Left;
                zmissile3.Top = powerarmour.Top + 70;//+10
            }
        }
        void ArmouredMovement()
        {
            if (right == true)
            {
                if (armouredPlayer.Left < 900)
                {
                    armouredPlayer.Left += 20;
                }
            }
            if (left == true)
            {
                if (armouredPlayer.Left > 5)
                {
                    armouredPlayer.Left -= 15;
                }
            }
            if (up == true)
            {
                if (armouredPlayer.Top > 20)
                {
                    armouredPlayer.Top -= 20;
                }
            }
            if (down == true)
            {//put picture boundaries here
                if (armouredPlayer.Top < 600)
                {
                    armouredPlayer.Top += 20;
                }
            }
        }
        void SuperMovement()
        {
            if (right == true)
            {
                if (playersuper.Left < 900)
                {
                    playersuper.Left += 20;
                }
            }
            if (left == true)
            {
                if (playersuper.Left > 5)
                {
                    playersuper.Left -= 15;
                }
            }
            if (up == true)
            {
                if (playersuper.Top > 20)
                {
                    playersuper.Top -= 20;
                }
            }
            if (down == true)
            {//put picture boundaries here
                if (playersuper.Top < 650)
                {
                    playersuper.Top += 20;
                }
            }
        }
        private void Game_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Right)
            {
                right = false;
            }
            if (e.KeyCode == Keys.Left)
            {
                left = false;
            }
            if (e.KeyCode == Keys.Up)
            {
                up = false;
            }
            if (e.KeyCode == Keys.Down)
            {
                down = false;
            }
            if (e.KeyCode == Keys.Space)
            {
                space = false;
            }
            if (e.KeyCode == Keys.A)
            {
                A = false;
            }
        }
        void BossMove()
        {
            //Bounces first boss up and down on screen   
            powerarmour.Left = objx;
            powerarmour.Top = objy;

            objx += volx;
            if (objx < 10)
            {
                volx = -volx;
            }
            else if (objx + objwidth > ClientSize.Width)
            {
                volx = -volx;
            }
            objy += voly;
            if (objy < 10)
            {
                voly = -voly;
            }
            else if (objy + objheight > ClientSize.Height)
            {
                voly = -voly;
            }
            Refresh();
        }
        private void bouncingtimer_Tick(object sender, EventArgs e)
        {
            BossMove();
        }



        void movemissile()//moves missile on screen
        {
            foreach (Control y in this.Controls)
            {
                if (y is PictureBox && y.Tag == "missile")
                {
                    y.Left += 100;//x.Top -= 10;
                    if (y.Top > 900)//<100
                    {
                        this.Controls.Remove(y);
                    }
                }
            }
        }
        private void Game_Load(object sender, EventArgs e)
        {
            //ModifyProgressBarColor.SetState(BHEALTH, progressBarRed);
            //textBox1.Visible = false;
            //mad.Visible = false;
            //
            Random rand = new Random();
            volx = rand.Next(1, 4);//1,4
            voly = rand.Next(1, 8);//1,4
            objx = powerarmour.Left;
            objy = powerarmour.Top;
            objwidth = powerarmour.Width;

            objx = rand.Next(0, ClientSize.Width - objwidth);
            objy = rand.Next(0, ClientSize.Height - objheight);
            this.SetStyle(
                ControlStyles.AllPaintingInWmPaint |
                //ControlStyles.UserPaint,
                ControlStyles.OptimizedDoubleBuffer, true);
            this.UpdateStyles();
        }
        void Missile()
        {
            //positions missile for player
            PictureBox m = new PictureBox();
            m.SizeMode = PictureBoxSizeMode.AutoSize;
            m.Image = Properties.Resources.Missile1;
            m.BackColor = System.Drawing.Color.Transparent;
            m.Tag = "missile";
            m.Left = playersuper.Left + 100;//moves bullet left or right
            m.Top = playersuper.Top + 10;//55 is perfect
            this.Controls.Add(m);
            m.BringToFront();
        }
        void AddMissiles()//frequency of rearmed missiles appear on screen
        {//makes missile icon appear and scroll across the screen
            Random addmiss = new Random();
            m++;
            int mi;

            nmissiles.Left -= 10;
            if (m == 100)
            {
                nmissiles.Visible = true;
                mi = addmiss.Next(50, 550);
                nmissiles.Location = new Point(1200, mi);
            }
            else if (m == 500)
                m = 0;

            foreach (Control m in this.Controls)
            {
                if (m is PictureBox && m.Tag == "MISSILES")
                {
                    if (armouredPlayer.Bounds.IntersectsWith(nmissiles.Bounds) || playersuper.Bounds.IntersectsWith(nmissiles.Bounds))
                    {
                        nmissiles.Visible = false;//this.Controls.Remove(m);
                    }
                }
            }
        }
        void Health()//Handles icon to heal player. Randomly appears in different places on screen
        {
            Random hpup = new Random();
            i++;
            int hp;
            foreach (Control h in this.Controls)
            {
                if (h is PictureBox && h.Tag == "HEAL")
                {
                    healthup.Left -= 10;
                    if (armouredPlayer.Bounds.IntersectsWith(healthup.Bounds) || (playersuper.Bounds.IntersectsWith(healthup.Bounds)))
                    {
                        healthup.Visible = false;
                    }
                    if (i == 100 && healthup.Left < 0)// i == 100
                    {
                        healthup.Visible = true;
                        hp = hpup.Next(50, 500);
                        healthup.Location = new Point(1200, hp);
                    }
                    if (i == 500)
                    {
                        i = 0;
                    }
                }
            }
        }
        void Start()
        {
            walking.Image = imageList1.Images[num];
            if (num == imageList1.Images.Count - 1)
            {
                num = 0;
            }
            else
                num++;

            shooting.Image = imageList2.Images[no];
            if (no == imageList2.Images.Count - 1)
            {
                no = 0;
            }
            else
                no++;
        }
        private void Armoured_Click(object sender, EventArgs e)
        {
            lblchoose.Visible = false;
            armouredPlayer.Visible = true;
            playersuper.Visible = false;
            Armoured.Visible = false;
            Super.Visible = false;
            walking.Visible = false;
            shooting.Visible = false;
            this.theme.Stop();
            //lbltitle.Visible = false;
            GameTimer.Start();
        }
        private void Super_Click(object sender, EventArgs e)
        {
            lblchoose.Visible = false;
            armouredPlayer.Visible = false;
            playersuper.Visible = true;
            Super.Visible = false;
            Armoured.Visible = false;
            walking.Visible = false;
            shooting.Visible = false;
            this.theme.Stop();
            //lbltitle.Visible = false;
            GameTimer.Start();
        }
        private void imagelisttimer_Tick(object sender, EventArgs e)
        {
            Start();
        }
        private void GameTimer_Tick(object sender, EventArgs e)
        {
            SuperMovement();
            ArmouredMovement();
            movebullet();
            movemissile();
            Health();
            AddMissiles();
            Enemies_move();
            Explosion();
            HitorMiss();
            EnemymoveBullet();
            GameScore();

        }
    }
}

Recommended Answers

There's over one thousand lines of code there. Next time give us where to look.

Jump to Post

Think of what differs from the new game to the code for next level. Maybe that UpdateStyles?

Jump to Post

All 7 Replies

Sorry, I thought you needed the whole code. Ok Ill break it down to show what part I'm stuck on in the program.

This is part of the function which handles when the boss is hit by the player laser and what happens when the boss dies. It also calls 3 functions
GameScore();//as game plays the players score increases
GameLevel();// will show what level the player is on
NextLevel();//Which puts all of the enemies randomly on the far right of the screen

if (i is PictureBox && i.Tag == "boss")
                        {
                            if (j.Bounds.IntersectsWith(i.Bounds))
                            {
                                if (enemyhealth.Value <= 0)
                                {
                                    i.Top = -750;
                                    mplayer.close();
                                    PictureBox shoot = new PictureBox();
                                    shoot.SizeMode = PictureBoxSizeMode.AutoSize;
                                    shoot.Image = Properties.Resources.Shoot;
                                    shoot.BackColor = System.Drawing.Color.Transparent;
                                    ((PictureBox)j).Image = Properties.Resources.explosion;
                                    nomissiles.Value = 100;
                                    healthbar.Value = 100;
                                    nomissiles.Value = 100;
                                    healthbar.Value = 100;
                                    playersuper.Location = new Point(0, 250);
                                    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();
                                    nmissiles.Visible = false;
                                    healthup.Visible = false;
                                    enemyhealth.Visible = false;
                                    lblbosshealth.Visible = false;
                                    victory = new SoundPlayer("victory.wav");
                                    victory.Play();
                                    fly.URL = "gundam_soaring_by.mp3";
                                    fly.controls.play();
                                    nomissiles.Value = 100;
                                    healthbar.Value = 100;
                                    nomissiles.Value = 100;
                                    healthbar.Value = 100;
                                    GameScore();//as game plays the players score increases
                                    GameLevel();// will show what level the player is on
                                    powerarmour.Visible = false;
                                    e9laser.Visible = false;
                                    powerarmour.Location = new Point(-250, -50);//
                                    e9laser.Location = new Point(-150, 50);  //(1250,50);
                                    boom.Visible = false;
                                    boom1.Visible = false;
                                    boom2.Visible = false;
                                    boom3.Visible = false;
                                    boom4.Visible = false;
                                    boom5.Visible = false;
                                    lblyoukilled.Visible = true;
                                    lblkilled.Visible = true;
                                    lblenemies.Visible = true; 
                                }
                                else
                                    enemyhealth.Value -= 5;
                            }
                        }

This stops the boss from bouncing all over the screen, show how many enemies the player has killed

        private void finaletimer_Tick(object sender, EventArgs e)
        {
            if (enemyhealth.Value <= 0)
            {
                bouncingtimer.Stop();
                lblkilled.Text = "" + kills;//shows how many enemies player killed
                AutoMovePlayer();
            }
        }

When the boss dies the player scrolls across the screen from left to right, the label will show how many enemies the player killed and their score. The only way I could do this was to use a new time

        void AutoMovePlayer()
        {
            //This will move the player across the screen after the boss is beaten
            //lblscore = lblfinalscore;
            endlevel++;
            GameTimer.Enabled = true;
            enemyhealth.Visible = false;
            lblbosshealth.Visible = false;
            playersuper.Left = playersuper.Left + 20;
            if (playersuper.Left >= 1400)
            {
                enemyhealth.Visible = false;
                lblbosshealth.Visible = false;
                lblfinalpoints.Visible = true;
                GameTimer.Enabled = false;
                lblscoreforlevel.Visible = true;
                lblfinalpoints.Text = "" + score;//displays current score
            }
            armouredPlayer.Left = armouredPlayer.Left + 20;
            if(armouredPlayer.Left > 1400)
            {
                enemyhealth.Visible = false;
                lblbosshealth.Visible = false;
                lblfinalpoints.Visible = true;
                GameTimer.Enabled = false;
                lblscoreforlevel.Visible = true;
                lblfinalpoints.Text = "" + score;//displays current score
            }
        }

Think of what differs from the new game to the code for next level. Maybe that UpdateStyles?

I did what you suggested and tried to do the same thing I have for next level that I have on new game and it still doesn't work. Do you have any other ideas? I'm really stuck

commented: That item was the only item that stuck out to me. Again, look for what's different from a new board to this nextlevel. +15

I did what you suggested and honestly I just don't see it. I broke that function down to the basics, took out the extra features and only left the code which shows the boss blowing up and after the player defeats the boss, the player is frozen in place. I checked my entire code ine per line and didn't see anywhere that the game timer was stoped.

You've written something new with your last reply about the timer. Look at that line with timer1.Interval at 249.

I wonder here about that value since it's in ResetGameAfterDeath. How was timer1.Interval set when the game first ran?

Maybe you are in Visual Studio and the timer1.Interval value was from the IDE and then later in this function you set it.

-> Again, what's different from the working first round to the failing second round?

I figured it out. The answer was right in front of my eyes and I didn't see it. Thank you for your help.

Be a part of the DaniWeb community

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