Ejemplo n.º 1
0
        private void Timer_Tick(object sender, EventArgs e)
        {
            timer.Stop();
            animate();
            CheckButton();
            Player1Panel.Image = player1;
            pictureBox2.Image  = Dog;
            pictureBox1.Image  = Banana;
            pictureBox3.Image  = button;
            MethodInvoker mi = new MethodInvoker(() => Player1Panel.Refresh());

            mi.Invoke();
            Animated = true;
            RunGame();
        }
Ejemplo n.º 2
0
        private void animate()
        {
            // PLAYER 1
            if (Idle)
            {
                if (IdleState < 5)
                {
                    player1 = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/GokuIdle.bmp");
                    IdleState++;
                }
                else if (IdleState >= 5 && IdleState < 10)
                {
                    player1 = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/GokuIdle1.bmp");
                    IdleState++;
                }
                else
                {
                    IdleState = 0;
                }
            }
            else if (MovingRight)
            {
                switch (MovingState)
                {
                case 0:
                    player1 = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/GokuStand.bmp");
                    Player1Panel.SetBounds(Player1Panel.Location.X + 2, Player1Panel.Location.Y, Player1Panel.Width, Player1Panel.Height);
                    break;

                case 1:
                    player1 = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/GokuWalk1.bmp");
                    Player1Panel.SetBounds(Player1Panel.Location.X + 2, Player1Panel.Location.Y, Player1Panel.Width, Player1Panel.Height);
                    break;

                case 2:
                    player1 = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/GokuWalk2.bmp");
                    Player1Panel.SetBounds(Player1Panel.Location.X + 2, Player1Panel.Location.Y, Player1Panel.Width, Player1Panel.Height);
                    break;

                case 3:
                    player1 = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/GokuWalk3.bmp");
                    Player1Panel.SetBounds(Player1Panel.Location.X + 2, Player1Panel.Location.Y, Player1Panel.Width, Player1Panel.Height);
                    break;

                case 4:
                    player1 = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/GokuRun1.bmp");
                    Player1Panel.SetBounds(Player1Panel.Location.X + 10, Player1Panel.Location.Y, Player1Panel.Width, Player1Panel.Height);
                    break;

                case 5:
                    player1 = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/GokuRun2.bmp");
                    Player1Panel.SetBounds(Player1Panel.Location.X + 10, Player1Panel.Location.Y, Player1Panel.Width, Player1Panel.Height);
                    break;

                case 6:
                    player1 = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/GokuRun3.bmp");
                    Player1Panel.SetBounds(Player1Panel.Location.X + 10, Player1Panel.Location.Y, Player1Panel.Width, Player1Panel.Height);
                    break;

                case 7:
                    player1 = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/GokuRun4.bmp");
                    Player1Panel.SetBounds(Player1Panel.Location.X + 10, Player1Panel.Location.Y, Player1Panel.Width, Player1Panel.Height);
                    break;

                case 8:
                    player1 = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/GokuRun5.bmp");
                    Player1Panel.SetBounds(Player1Panel.Location.X + 10, Player1Panel.Location.Y, Player1Panel.Width, Player1Panel.Height);
                    break;

                case 9:
                    player1 = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/GokuRun6.bmp");
                    Player1Panel.SetBounds(Player1Panel.Location.X + 10, Player1Panel.Location.Y, Player1Panel.Width, Player1Panel.Height);
                    break;

                case 10:
                    player1 = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/GokuRun7.bmp");
                    Player1Panel.SetBounds(Player1Panel.Location.X + 10, Player1Panel.Location.Y, Player1Panel.Width, Player1Panel.Height);
                    break;
                }
            }
            else if (MovingLeft)
            {
                switch (MovingState)
                {
                case 0:
                    player1 = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/GokuStandL.bmp");
                    Player1Panel.SetBounds(Player1Panel.Location.X - 2, Player1Panel.Location.Y, Player1Panel.Width, Player1Panel.Height);
                    break;

                case 1:
                    player1 = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/GokuWalk1L.bmp");
                    Player1Panel.SetBounds(Player1Panel.Location.X - 2, Player1Panel.Location.Y, Player1Panel.Width, Player1Panel.Height);
                    break;

                case 2:
                    player1 = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/GokuWalk2L.bmp");
                    Player1Panel.SetBounds(Player1Panel.Location.X - 2, Player1Panel.Location.Y, Player1Panel.Width, Player1Panel.Height);
                    break;

                case 3:
                    player1 = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/GokuWalk3L.bmp");
                    Player1Panel.SetBounds(Player1Panel.Location.X - 2, Player1Panel.Location.Y, Player1Panel.Width, Player1Panel.Height);
                    break;

                case 4:
                    player1 = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/GokuRunL1.bmp");
                    Player1Panel.SetBounds(Player1Panel.Location.X - 10, Player1Panel.Location.Y, Player1Panel.Width, Player1Panel.Height);
                    break;

                case 5:
                    player1 = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/GokuRun2L.bmp");
                    Player1Panel.SetBounds(Player1Panel.Location.X - 10, Player1Panel.Location.Y, Player1Panel.Width, Player1Panel.Height);
                    break;

                case 6:
                    player1 = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/GokuRun3L.bmp");
                    Player1Panel.SetBounds(Player1Panel.Location.X - 10, Player1Panel.Location.Y, Player1Panel.Width, Player1Panel.Height);
                    break;

                case 7:
                    player1 = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/GokuRun4L.bmp");
                    Player1Panel.SetBounds(Player1Panel.Location.X - 10, Player1Panel.Location.Y, Player1Panel.Width, Player1Panel.Height);
                    break;

                case 8:
                    player1 = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/GokuRun5L.bmp");
                    Player1Panel.SetBounds(Player1Panel.Location.X - 10, Player1Panel.Location.Y, Player1Panel.Width, Player1Panel.Height);
                    break;

                case 9:
                    player1 = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/GokuRun6L.bmp");
                    Player1Panel.SetBounds(Player1Panel.Location.X - 10, Player1Panel.Location.Y, Player1Panel.Width, Player1Panel.Height);
                    break;

                case 10:
                    player1 = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/GokuRun7L.bmp");
                    Player1Panel.SetBounds(Player1Panel.Location.X - 10, Player1Panel.Location.Y, Player1Panel.Width, Player1Panel.Height);
                    break;
                }
            }



            // DOG
            if (!Button)
            {
                if (DogState < 3)
                {
                    Dog = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/Dog2.bmp");
                    DogState++;
                }
                else if (DogState >= 3 && DogState < 5)
                {
                    Dog = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/Dog.bmp");
                    DogState++;
                }
                else
                {
                    DogState = 0;
                }
            }
            else
            {
                Dog = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/Background.bmp");
            }

            // BANANA
            if (!Button)
            {
                if (BananaState < 3)
                {
                    Banana = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/Bannan2.bmp");
                    BananaState++;
                }
                else if (BananaState >= 3 && BananaState < 5)
                {
                    Banana = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/Bannan.bmp");
                    BananaState++;
                }
                else
                {
                    BananaState = 0;
                }
            }
            else
            {
                if (BananaState < 3)
                {
                    Banana = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/PBJT1.bmp");
                    BananaState++;
                }
                else if (BananaState >= 3 && BananaState < 5)
                {
                    Banana = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/PBJT2.bmp");
                    BananaState++;
                }
                else
                {
                    BananaState = 0;
                }
            }

            //Button
            if (Button)
            {
                button = new Bitmap("C:/Users/Skoga/Pictures/Saved Pictures/button2.bmp");
            }
        }