Click here to Skip to main content
15,999,626 members
Please Sign up or sign in to vote.
2.67/5 (3 votes)
See more:
This is my code
C#
private void timer2_Tick(object sender, EventArgs e)
       {
            // level 1
           int movement = 0;
           if (label2.Text == "This Is Level 1")
           {movement = 5;
               if (Death.Width == 64)
               {
                   Death.Location = new Point(Death.Location.X + movement, Death.Location.Y);
               }

               if (Death.Location == new Point(390, 202))
               {
                   Death.Width = 63;
               }
               if (Death.Width == 63)
               {
                   Death.Location = new Point(Death.Location.X - movement, Death.Location.Y);
               }

               if (Death.Location == new Point(30, 202))
               {
                   Death.Width = 64;
               }
           }
           // level 2
           if (label2.Text == "This Is Level 2")
           {movement = 15;
               if (Death.Width == 64)
               {
                   Death.Location = new Point(Death.Location.X + movement, Death.Location.Y);
               }

               if (Death.Location == new Point(390, 202))
               {
                   Death.Width = 63;
               }
               if (Death.Width == 63)
               {
                   Death.Location = new Point(Death.Location.X - movement, Death.Location.Y);
               }

               if (Death.Location == new Point(30, 202))
               {
                   Death.Width = 64;
               }
           }

       }


When it hits level 2 its meant to go even faster but for some reason it just freezes, can anyone help me?
Posted

1 solution

I just tried your code and it is working fine for me. As I don't know what "Death" is, I named a button as Death and I can clearly see the two speeds when moving. So, there must be some issue in another part of your code.
 
Share this answer
 
Comments
Espen Harlinn 25-Feb-11 6:50am    
Good effort, my 5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900