引擎實作?

靠杯中間走不出來sorry orz 人生第一台GAMEBOY當然是玩神奇寶貝,以前就有想實現了,RPG遊戲製作大師的年代,恩~學以致用我們來實現他吧! 還沒講完,宅男們都暴動拉(也得到C#助教的契機??

大改!

繼上次的神奇寶貝RPG,這期新增的功能礙於神奇寶貝需要跟百分之百模擬畫面,所以畫面要模擬成顯示角色周圍X軸加+10和-10 Y軸+10和-10,以往的是一開始就加載所有地圖,導致整個地圖在繪製多物件的時候會讓程式效率不足,所以角色移動不再是真正的在FORM裡面移動是固定在中央每次鍵盤按下去只會對針對的X和Y軸做計算,再來傳送到繪製地圖兩個迴圈進行繪圖,大大提高程式效率,到最後還是達成了這個大改算是把之前的角色對話、判斷是否面對面、事件等等,所有涉及到座標的都必須更改,此外還新增NPC走路只要載入特定的素材檔,開發者只要4行就可以操縱NPC走路方向,整體來說神奇寶貝RPG就是基於RPG遊戲製作大師工具而啟發的,這個專體寫到後面說是遊戲到不如說是一個RPG遊戲開發引擎,下面會來為各位做一個統整。 1.畫面變動更改物品增加與移除 2.劇情功能設定將配合下面對話功能和戰鬥畫面衍生而出劇情。 3.對話功能增加鎖按鍵(不能移動)。 4.戰鬥畫面設計介面新增。 5.碰撞功能分為靜態與動態。 6.新增功能有草叢遇怪物功能,沒抓寵功能因為遊戲畫面大改導致沒有實現。 7.道館也是因為遊戲畫面大改導致沒有實現。 8.捕捉神奇寶貝功能新增 9.可以在功能欄位裡面選擇神奇寶貝並可用來與其他角色戰鬥

我們來看圖吧!(部落格被砍了,實在懶得再拍影片

--- 主畫面恩~不錯

三層陣列

這意味者照期中的方式來繪圖將會大大增加記憶體和CPU使用率,但如果改用期末的畫面的話將大幅提升效能,也增加了可調螢幕解析度讓遊戲畫面不再受侷限,將可以用來製作迷宮方面,不再是一下子就找到事件的地點了,使得探索大大提升畫面可玩性。

偽2.5D樹木

---

戰鬥功能新增介面和攻擊爆擊

---

草叢遭遇野生怪物

---

捕捉神奇寶貝

---

NPC對戰系統

---

rpg.code

C#:2DRPG engine.md

markdown
# C#:2DRPG engine

執行畫面

![](https://hackpad-attachments.s3.amazonaws.com/hackpad.com_vSUCQe73kSM_p.517873_1481411746265_undefined)

![](https://hackpad-attachments.s3.amazonaws.com/hackpad.com_vSUCQe73kSM_p.517873_1481411752342_undefined)

![](https://hackpad-attachments.s3.amazonaws.com/hackpad.com_vSUCQe73kSM_p.517873_1481411759033_undefined)

## **

![](https://hackpad-attachments.s3.amazonaws.com/hackpad.com_vSUCQe73kSM_p.517873_1481411784530_undefined)

![](https://hackpad-attachments.s3.amazonaws.com/hackpad.com_vSUCQe73kSM_p.517873_1481411791234_undefined)

![](https://hackpad-attachments.s3.amazonaws.com/hackpad.com_vSUCQe73kSM_p.517873_1481411814841_undefined)![](https://hackpad-attachments.s3.amazonaws.com/hackpad.com_vSUCQe73kSM_p.517873_1481411890205_undefined)![](https://hackpad-attachments.s3.amazonaws.com/hackpad.com_vSUCQe73kSM_p.517873_1481411895498_undefined)![](https://hackpad-attachments.s3.amazonaws.com/hackpad.com_vSUCQe73kSM_p.517873_1481411921315_undefined)

## 下載

https://drive.google.com/file/d/0BxviYtvMZsvCMTdmTlA4ZnRZTmM/view?usp=sharing

C#:2DRPG engine_Class1.cs

csharp
using System;
using System.Collections.Generic;
//using System.Linq;
using System.Text;

using System.Drawing;
using System.Windows.Forms;
using System.Threading;
using System.Runtime.InteropServices;
using WMPLib;
using System.IO;

namespace WindowsFormsApplication1
{
    public class Class1
    {
        System.Windows.Forms.Timer aTimer;
        public MP3Player backer = new MP3Player();
        public int loding = 0;
        public int touch;
        public int plx = 560;
        public int ply = 240;
        public int pb1x = 0;
        public int pb1y = 0;
        public int orplx = 240;
        public int orply = 240;
        public int msx;
        public int msy;
        public int wallx;
        public int wally;
        public int u, p, r, f;
        public string backroundsound;
        public string size;
        public int ms1_ev = 0;
        public int ms2_ev = 0;
        public int map1_ev = 0;
        public int train;
        public int face;
        public int face_back;
        public int touch2;
        public int touch3;
        public int[] max_map;
        public int[] max_monster;
        public int[] max_wall;
        public string now_map = "Test";
        public int beforex;
        public int beforey;
        public int INL;
        public int times;
        public byte lightblack = 255;
        public int lightblack2 = 255;
        public int map_loading = 0;
        int z;
        int y;
        public int nowid;
        public int changemaptest = 0;
        public int changemaping = 0;
        public int changemaping2 = 0;
        System.Timers.Timer timersTimer = new System.Timers.Timer();
        System.Timers.Timer timersTimer2 = new System.Timers.Timer();

        /// <summary> ///////////////////////////////////////////////////////
        Bitmap bmplayer = new Bitmap("pok/player.png");
        Bitmap bmplayer2 = new Bitmap("pok/2.png");
        Bitmap bmptmp;
        Bitmap bmpman = new Bitmap("pok/man.png");
        Bitmap bmpgirl = new Bitmap("pok/girl.png");
        Bitmap bmp2 = new Bitmap("pok/MAP2.jpg");

        Form gameform;
        worldmap worldmap;
        Playerparty playerparty;
        PictureBox worldmapspritepb;
        worldmapmonster[] map;
        worldmapmonster[] monster;
        worldmapmonster[] wall;
        KeyEventArgs tmpe;
        public int fight = 0;
        public CombatGUI atack;

        Image img;
        Graphics device;

        /// <切割圖片走圖>///////////////////////////////////////////////////////
        ///         public static Bitmap Resize(Bitmap originImage, Double times)
        private static Bitmap Process(Bitmap originImage, int oriwidth, int oriheight, int width, int height)
        {
            Bitmap resizedbitmap = new Bitmap(width, height);
            Graphics g = Graphics.FromImage(resizedbitmap);
            g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            g.Clear(Color.Transparent);
            g.DrawImage(originImage, new Rectangle(0, 0, width, height), new Rectangle(0, 0, oriwidth, oriheight), GraphicsUnit.Pixel);
            return resizedbitmap;
        }
        public static Bitmap Resize(Bitmap originImage, Double times)
        {
            int width = Convert.ToInt32(originImage.Width * times);
            int height = Convert.ToInt32(originImage.Height * times);

            return Process(originImage, originImage.Width, originImage.Height, width, height);
        }
        public Bitmap TakeScreenshot(int y, int x, Bitmap bmpx, int cutx1, int cutx2, int cuty1, int cuty2, double multiple)
        {
            Bitmap destBitmap = new Bitmap(bmpx.Width, bmpx.Height);
            Rectangle destRect = new Rectangle(0, 0, destBitmap.Width / cutx1, destBitmap.Height / cuty1); // 你的輸出範圍
            Rectangle srcRect = new Rectangle(y, x, bmpx.Width / cutx1, bmpx.Height / cuty2); // 你的原圖剪裁區域
            Graphics.FromImage(destBitmap).DrawImage(bmpx, destRect, srcRect, GraphicsUnit.Pixel);
            return Resize(destBitmap, multiple);
        }

        public void AlphaBlend(Bitmap source, byte alpha, Color backColor)
        {
            for (int x = 0; x < source.Width; x++)
            {
                for (int y = 0; y < source.Height; y++)
                {
                    Color sc = source.GetPixel(x, y);
                    byte R = (byte)(sc.R * alpha / 255 + backColor.R * (255 - alpha) / 255);
                    byte G = (byte)(sc.G * alpha / 255 + backColor.G * (255 - alpha) / 255);
                    byte B = (byte)(sc.B * alpha / 255 + backColor.B * (255 - alpha) / 255);
                    byte A = (byte)(sc.A * alpha / 255 + backColor.A * (255 - alpha) / 255);
                    source.SetPixel(x, y, Color.FromArgb(A, R, G, B));
                }
            }
        }

        public Class1(Form form)
        {

            //////////////////////////////////////////////////////////
            map = new worldmapmonster[10];
            monster = new worldmapmonster[10];

            Bitmap bmp = new Bitmap("pok/player.png");
            gameform = form;
            gameform.Width = 700;
            gameform.Height = 700;
            gameform.BackColor = Color.White;
            gameform.BackgroundImage = new Bitmap("pok/MAP.jpg");
            worldmap = new worldmap(gameform);


            playerparty = new Playerparty(new Point(plx, ply), TakeScreenshot(0, 0, bmp, 4, 4, 4, 4, 2), 1);
            worldmapspritepb = new PictureBox();
            worldmapspritepb.Width = gameform.Width;
            worldmapspritepb.Height = gameform.Height;
            worldmapspritepb.BackColor = Color.Transparent;
            worldmapspritepb.Parent = gameform;


            loding = 1;



            changemap("Test.txt");

            ///////////////////////////////////////////////////////////

        }
        [DllImport("user32.dll")]//取设备场景   
        private static extern IntPtr GetDC(IntPtr hwnd);//返回设备场景句柄   
        [DllImport("gdi32.dll")]//取指定点颜色   
        private static extern int GetPixel(IntPtr hdc, Point p);
        int tmpxx = 0;
        /*  private void TimerEventProcessor2(object myObject, EventArgs myEventArgs)
        /  {
              Point p = new Point(0,0);//取置顶点坐标   
              IntPtr hdc = GetDC(new IntPtr(0));//取到设备场景(0就是全屏的设备场景)   
              int c = GetPixel(hdc, p);//取指定点颜色   
              int r = (c & 0xFF);//转换R   
              int g = (c & 0xFF00) / 256;//转换G   
              int b = (c & 0xFF0000) / 65536;//转换B   
              if (r == 255 && g == 255 && b == 255)
              {
                  gameform.Refresh();

                  changemaping2 = 1;
                  changemaping = 0;

                  draw();
              }
              timersTimer2.Start();
          }*/
        /* private void TimerEventProcessor(object myObject, EventArgs myEventArgs)
         {


             if (lightblack2 <= 0)
             {

                 a = new Bitmap("cl2.jpg");
                 playerparty.partsprite.draw2(device, plx, ply);
                 lightblack2 = lightblack = 255;
                 worldmapspritepb.Image = TakeScreenshot(0, 0, a, 1, 1, 1, 1,360);
                 playerparty.partsprite.draw2(device, plx, ply);

                 gameform.Refresh();


                 timersTimer2.Start();
             }
             else if(lightblack2>0)

             timersTimer.Start();

             lightblack2 -= 5;
             AlphaBlend(a, lightblack -=1, Color.Black);
             worldmapspritepb.Image = TakeScreenshot(0, 0, a, 1, 1, 1, 1, 360);
         }*/

        public void talkface(int kind, int x)
        {

            if (nowid == 2)
                bmptmp = bmpman;
            if (nowid == 3)
                bmptmp = bmpgirl;
            monster[x].look(kind, monster[x].id);
            monster[x].draw(device);
            draw();

        }
        public int msty(int x)
        {
            return monster[x].location.Y;
        }
        public int npcmove(int kind, int x, int times)
        {

            if (nowid == 2)
                bmptmp = bmpman;
            if (nowid == 3)
                bmptmp = bmpgirl;

            max_monster[x] = updata(playerparty.partsprite.UPdata(), monster[x].UPdata(), monster[x].location.X, monster[x].location.Y, plx, ply);

            if (kind == 2 && monster[x].location.Y - 40 != ply || monster[x].location.X != plx)
            {

                monster[x].move(kind, monster[x].id, times, max_monster[x]);

                msy = monster[x].location.Y;
                monster[x].draw(device);
                draw();
                return 1;
            }
            else if (kind == 1 && monster[x].location.Y + 40 != ply || monster[x].location.X != plx)
            {
                monster[x].move(kind, monster[x].id, times, max_monster[x]);

                msy = monster[x].location.Y;
                monster[x].draw(device);
                draw();
                return 1;

            }

            else

                return 0;

        }
        public int npcmove2(int kind, int x, int times)
        {

            if (nowid == 2)
                bmptmp = bmpman;
            if (nowid == 3)
                bmptmp = bmpgirl;

            max_monster[x] = updata(playerparty.partsprite.UPdata(), monster[x].UPdata(), monster[x].location.X, monster[x].location.Y, plx, ply);
            if (kind == 3 && monster[x].location.X - 40 != plx || monster[x].location.Y != ply)
            {

                monster[x].move(kind, monster[x].id, times, max_monster[x]);

                msx = monster[x].location.X;

                monster[x].draw(device);
                worldmapspritepb.Image = img;
                draw();
                return 1;
            }
            else if (kind == 4 && monster[x].location.X + 40 != plx || monster[x].location.Y != ply)
            {

                monster[x].move(kind, monster[x].id, times, max_monster[x]);
                msx = monster[x].location.X;
                monster[x].draw(device);
                worldmapspritepb.Image = img;
                draw();
                return 1;
            }
            else
                return 0;

        }
        public void mapadd()
        {

            z = 0;
            y = 0;

            for (int i = 0; i < 50; i++)
                for (int j = 0; j < 41; j++)
                {
                    if (worldmap.maparr[i, j] == 2)
                    {
                        monster[z] = new worldmapmonster(new Point(i * 40, j * 40), TakeScreenshot(20, 64, bmpman, 3, 3, 4, 4, 2), 2);
                        z++;
                    }
                    if (worldmap.maparr[i, j] == 5)
                    {
                        monster[z] = new worldmapmonster(new Point(i * 40, j * 40), TakeScreenshot(20, 64, bmpgirl, 3, 3, 4, 4, 2), 3);
                        z++;
                    }
                }

            max_monster = new int[z];
            try
            {
                timersTimer.Start();
            }
            catch { timersTimer.Stop(); }
        }

        ///數據更新///////////////////////////////////////////////////////////
        public int updata(Rectangle player, Rectangle mon, int targetx, int targety, int mex, int mey)
        {

            bool overlapped = player.IntersectsWith(mon);
            if (overlapped == true)
            {
                plx = mex;
                ply = mey;
                msx = targetx;
                msy = targety;
                if (face == 4 & (msx == plx - 40) & (msx < plx) & (msy == ply))
                    return 1;
                else if (face == 1 & (msx == plx + 40) & (msx > plx) & (msy == ply))
                    return 1;
                else if (face == 2 & (msy == ply - 40) & (msy < ply) & (msx == plx))
                    return 1;
                else if (face == 3 & (msy == ply + 40) & (msy > ply) & (msx == plx))
                    return 1;
                else if ((msy != ply) & (msx != plx))
                    return 0;
                else
                    return 0;
            }
            else
            {
                plx = mex;
                ply = mey;
                return 0;
            }


        }

        public bool walltest()
        {

            if (((plx / 40) <= 50) && (worldmap.maparr[(plx / 40) + 1, ply / 40] == 5 || worldmap.maparr[(plx / 40) + 1, ply / 40] == 6 || /*worldmap.maparr[(plx / 40) + 1, ply / 40] == 2||*/ worldmap.maparr[(plx / 40) + 1, ply / 40] == 3 || worldmap.maparr[(plx / 40) + 1, ply / 40] == 1) && face == 1)
                return false;
            if (((plx / 40) - 1 >= 0) && (worldmap.maparr[(plx / 40) - 1, ply / 40] == 5 || worldmap.maparr[(plx / 40) - 1, ply / 40] == 6 ||/* worldmap.maparr[(plx / 40) - 1, ply / 40] == 2|| */worldmap.maparr[(plx / 40) - 1, ply / 40] == 3 || worldmap.maparr[(plx / 40) - 1, ply / 40] == 1) && face == 4)
                return false;
            if (((ply / 40) - 1 >= 0) && (worldmap.maparr[(plx / 40), ply / 40 - 1] == 5 || worldmap.maparr[(plx / 40), ply / 40 - 1] == 6 || /*worldmap.maparr[(plx / 40), (ply / 40) - 1] == 2||*/ worldmap.maparr[(plx / 40), (ply / 40) - 1] == 3 || worldmap.maparr[(plx / 40), (ply / 40) - 1] == 1) && face == 2)
                return false;
            if ((ply / 40) <= 40 && (worldmap.maparr[(plx / 40), ply / 40 + 1] == 5 || worldmap.maparr[(plx / 40), ply / 40 + 1] == 6 || /*worldmap.maparr[(plx / 40), (ply / 40) + 1] == 2|| */worldmap.maparr[(plx / 40), (ply / 40) + 1] == 3 || worldmap.maparr[(plx / 40), (ply / 40) + 1] == 1) && face == 3)

                return false;

            else
                return true;
        }
        public int monst()
        {
            Random crandom = new Random(Guid.NewGuid().GetHashCode());
            int crit = crandom.Next(1, 100);

            if (worldmap.maparr[(plx / 40), (ply / 40) + 1] == 7)
            {

                if (crit > 95)

                    return 1;


                else
                    return 0;
            }
            else
                return 0;
        }
        public bool walltest2(int tmp)
        {
            if (((plx / 40) + 1 <= 50) && (worldmap.maparr[(plx / 40) + 1, ply / 40] == tmp && face == 1))
                return false;
            if (((plx / 40) - 1 >= 0) && (worldmap.maparr[(plx / 40) - 1, ply / 40] == tmp && face == 4))
                return false;
            if (((ply / 40) - 1 >= 0) && (worldmap.maparr[(plx / 40), (ply / 40) - 1] == tmp && face == 2))
                return false;
            if ((ply / 40) + 1 <= 40 && (worldmap.maparr[(plx / 40), (ply / 40) + 1] == tmp && face == 3))
                return false;
            else
                return true;

        }

        /// <shark視窗震動>
        public void shock()
        {
            Point now_p = gameform.Location;
            Random r = new Random();
            for (int i = 0; i < 10; i++)
            {
                Point new_p = new Point(now_p.X + r.Next(-10, 10), now_p.Y + r.Next(-10, 10)); //新的位置
                gameform.Location = new_p;
                Thread t1 = new Thread(MyBackgroundTask2);
                t1.Start();
                t1.Join();
                gameform.Location = now_p; //還原位置

            }
        }
        /// <summary>
        /// monst事件
        /// </summary>
        /// 
        int pok_length;
        string all_pok;
        int item;
        string[] pokarr = new string[12];
        private void check_pok()
        {
            StreamReader sr = new StreamReader(@"pok.txt");
            string a;
            //===逐行讀取,直到檔尾===
            item = 0;
            while (!sr.EndOfStream)
            {
                a = sr.ReadLine();
                string[] strArray = a.Split(',');
                for (int i = 0; i < strArray.Length; i++)        //透過迴圈將陣列值取出 也可用foreach
                {
                    pokarr[item] = strArray[i].ToString();
                    item++;
                }

                pok_length = strArray.Length;
            }
            bmplayer = new Bitmap("pok/" + Convert.ToString(Convert.ToInt32(pokarr[((Convert.ToInt32(pokarr[0]) + 1) * 2)]) + 10) + ".png");
            sr.Close();

        }
        public void ms1()
        {
            gameform.Hide();
            atack = new CombatGUI();
            check_pok();
            atack.f1 = TakeScreenshot(0, 0, bmplayer, 1, 1, 1, 1, 2);
            bmplayer2 = new Bitmap("pok/20.png");
            atack.now_monname = "20";
            atack.f2 = TakeScreenshot(0, 0, bmplayer2, 1, 1, 1, 1, 2);
            atack.train = 1;
            atack.Show();
            fight = 1;
            ms1_ev = 1;
            atack.train = 1;
            touch2 = 0;
        }
        public void ms2()
        {
            gameform.Hide();
            atack = new CombatGUI();
            check_pok();
            atack.f1 = TakeScreenshot(0, 0, bmplayer, 1, 1, 1, 1, 2);
            Random crandom = new Random(Guid.NewGuid().GetHashCode());
            int crit = crandom.Next(0, 10);

            bmplayer2 = new Bitmap("pok/" + Convert.ToString(crit) + ".png");
            atack.now_monname = Convert.ToString(crit);
            atack.bmplayer3 = bmplayer2;
            atack.f2 = TakeScreenshot(0, 0, atack.bmplayer3, 1, 1, 1, 1, 2);

            atack.Show();
            fight = 1;

            atack.train = 0;
            touch2 = 0;
        }
        public void ms3()
        {
            gameform.Hide();
            atack = new CombatGUI();
            check_pok();
            atack.f1 = TakeScreenshot(0, 0, bmplayer, 1, 1, 1, 1, 2);
            bmplayer2 = new Bitmap("pok/011.png");
            atack.now_monname = "011";
            atack.f2 = TakeScreenshot(0, 0, bmplayer2, 1, 1, 1, 1, 2);
            atack.train = 1;
            atack.Show();
            fight = 1;
            ms2_ev = 1;
            atack.train = 1;
            touch2 = 0;
        }
        public void map1()
        {
            if (now_map == "Test.txt")
            {
                beforex = plx;
                beforey = ply;
                plx = 80;
                ply = 120;

                changemap("Test2.txt");
            }
            else if (now_map == "Test2.txt")
            {
                plx = beforex;
                ply = beforey;
                changemap("Test.txt");
            }
        }
        public void map2()
        {
            if (now_map == "Test.txt")
            {
                beforex = plx;
                beforey = ply;
                plx = 960;
                ply = 400;

                changemap("Test3.txt");
            }
            else if (now_map == "Test3.txt")
            {
                plx = beforex;
                ply = beforey;
                changemap("Test.txt");
            }
        }
        public void playernewpoint(int x, int y)
        {
            playerparty.partsprite.location = new Point(x, y);

        }
        public void handlekeypress(KeyEventArgs e)
        {

            tmpe = e;


            //   Thread t1 = new Thread(MyBackgroundTask);
            //   t1.Start();

            for (int i = 0; i < z; i++)
            {
                if (plx + 40 == monster[i].location.X || plx - 40 == monster[i].location.X || ply + 40 == monster[i].location.Y || ply - 40 == monster[i].location.Y)
                    max_monster[i] = updata(playerparty.partsprite.UPdata(), monster[i].UPdata(), monster[i].location.X, monster[i].location.Y, plx, ply);
            }
            if (e.KeyCode == Keys.Right)
            {

                face = 1;
                if ((plx + 40 != msx || ply != msy) && walltest())
                {


                    plx += 40; playerparty.partsprite.move(plx, ply, e, 1, 1);


                    //       worldmapspritepb.Location = new Point(worldmapspritepb.Location.X - 50, worldmapspritepb.Location.Y);
                    if (monst() == 1)
                    { ms2(); }
                }

                else
                {
                    if (walltest() == false)
                        backer.Play("sound/wall.wav"); handlekeypress2(e);
                }
            }
            if (e.KeyCode == Keys.Left)
            {

                face = 4;
                if ((plx - 40 != msx || ply != msy) && walltest())
                {


                    plx -= 40; playerparty.partsprite.move(plx, ply, e, 1, 4);
                    //     worldmapspritepb.Location = new Point(worldmapspritepb.Location.X + 50, worldmapspritepb.Location.Y);
                    if (monst() == 1)
                    { ms2(); }
                }
                else
                {
                    if (walltest() == false)
                        backer.Play("sound/wall.wav"); handlekeypress2(e);
                }
            }
            if (e.KeyCode == Keys.Up)
            {

                face = 2;
                if ((plx != msx || ply - 40 != msy) && walltest())
                {

                    ply -= 40;
                    playerparty.partsprite.move(plx, ply, e, 1, 2);
                    //    worldmapspritepb.Location = new Point(worldmapspritepb.Location.X , worldmapspritepb.Location.Y+50);
                    if (monst() == 1)
                    { ms2(); }
                }
                else
                {
                    if (walltest() == false)
                        backer.Play("sound/wall.wav"); handlekeypress2(e);
                }
            }
            if (e.KeyCode == Keys.Down)
            {

                face = 3;
                if ((plx != msx || ply + 40 != msy) && walltest())
                {

                    ply += 40; playerparty.partsprite.move(plx, ply, e, 1, 3);
                    //     worldmapspritepb.Location = new Point(worldmapspritepb.Location.X, worldmapspritepb.Location.Y -50);
                    if (monst() == 1)
                    { ms2(); }
                }
                else
                {
                    if (walltest() == false)
                        backer.Play("sound/wall.wav"); handlekeypress2(e);
                }

            }

            if (walltest2(4) == false)
                map1();
            if (walltest2(8) == false)
                map2();



            draw();

            //   t1.Join();
        }
        public void handlekeypress2(KeyEventArgs e)
        {

            if (e.KeyCode == Keys.Right)
            { playerparty.partsprite.move(plx, ply, e, 1, 5); }
            else if (e.KeyCode == Keys.Up)
            { playerparty.partsprite.move(plx, ply, e, 1, 6); }
            else if (e.KeyCode == Keys.Left)
            { playerparty.partsprite.move(plx, ply, e, 1, 7); }
            else if (e.KeyCode == Keys.Down)
            { playerparty.partsprite.move(plx, ply, e, 1, 8); }
            draw();
        }

        /// < MyBackgroundTask延遲函數>
        void MyBackgroundTask()
        {


            lightblack2 = lightblack = 255;


            changemaping = 0;
            changemaping2 = 1;
            if (changemaping2 == 1)
            {
                timersTimer.Stop();
                draw();
                changemaping2 = 1;

            }
        }
        void MyBackgroundTask2()
        {
            Thread.Sleep(10);
        }
        /// <View設定隱藏顯示>
        public void View(bool sw)
        {
            if (sw == true)
                gameform.Hide();
            else
                gameform.Show();
        }
        public void changemap(string mapname)
        {
            backer.Play("sound/changemap.wav");

            now_map = mapname;

            worldmap.inmap(mapname);
            mapadd();
            changemaptest = 1;
            times = 0;
            changemaping = 0;

        }

        private Image CutImage(Image SourceImage, Point StartPoint, Rectangle CutArea)
        {
            try
            {
                Bitmap NewBitmap = new Bitmap(CutArea.Width, CutArea.Height);
                Graphics tmpGraph = Graphics.FromImage(NewBitmap);
                tmpGraph.DrawImage(SourceImage, CutArea, StartPoint.X, StartPoint.Y, CutArea.Width, CutArea.Height, GraphicsUnit.Pixel);
                tmpGraph.Dispose();
                return NewBitmap;
            }
            catch { return null; }
        }

        public void draw()
        {

            img = new Bitmap(400 + plx, 400 + ply);


            device = Graphics.FromImage(img);

            for (int i = 0; i < z; i++)
            {
                monster[i].draw(device);
            }

            for (int i = 0; i < y; i++)
            {
                wall[i].draw(device);
            }

            worldmap.drawmap(device, plx / 40, ply / 40);


            playerparty.partsprite.draw2(device, plx, ply);
            worldmap.drawmap2(device);


            img = CutImage(img, new Point(plx - 320, ply - 280), new Rectangle(0, 0, 800, 800));
            worldmapspritepb.Image = img;

            gameform.Refresh();


            GC.Collect();//清除new物件 重要會吃記憶體

        }
    }
    class worldmap
    {
        private static Bitmap Process(Bitmap originImage, int oriwidth, int oriheight, int width, int height)
        {
            Bitmap resizedbitmap = new Bitmap(width, height);
            Graphics g = Graphics.FromImage(resizedbitmap);
            g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            g.Clear(Color.Transparent);
            g.DrawImage(originImage, new Rectangle(0, 0, width, height), new Rectangle(0, 0, oriwidth, oriheight), GraphicsUnit.Pixel);
            return resizedbitmap;
        }
        public static Bitmap Resize(Bitmap originImage, Double times)
        {
            int width = Convert.ToInt32(originImage.Width * times);
            int height = Convert.ToInt32(originImage.Height * times);

            return Process(originImage, originImage.Width, originImage.Height, width, height);
        }
        public Bitmap TakeScreenshot(int y, int x, Bitmap bmpx, int cutx1, int cutx2, int cuty1, int cuty2, double multiple)
        {
            Bitmap destBitmap = new Bitmap(bmpx.Width, bmpx.Height);
            Rectangle destRect = new Rectangle(0, 0, destBitmap.Width / cutx1, destBitmap.Height / cuty1); // 你的輸出範圍
            Rectangle srcRect = new Rectangle(y, x, bmpx.Width / cutx1, bmpx.Height / cuty2); // 你的原圖剪裁區域
            Graphics.FromImage(destBitmap).DrawImage(bmpx, destRect, srcRect, GraphicsUnit.Pixel);
            return Resize(destBitmap, multiple);
        }

        public worldmap(Form form)
        {
        }
        public float[,] maparr;
        public int tmpx;
        public int tmpy;
        public MP3Player backer = new MP3Player();
        public int loading = 0;
        public int loading2 = 0;
        public void inmap(string mapname)
        {
            int txtLength = 0, i = 0;
            string s1;
            FileStream fs = new FileStream(mapname, FileMode.Open);
            StreamReader sr = new StreamReader(fs, Encoding.Default);

            /* 取得行數 */
            s1 = sr.ReadLine();
            while (s1 != null)
            {
                txtLength++;
                s1 = sr.ReadLine();
            }
            fs.Position = 0;

            /* 取得資料並放入陣列 */
            string[] s2 = new string[2];
            float[,] txtValue = new float[50, 41];
            maparr = new float[50, 41];

            s1 = sr.ReadLine();
            while (s1 != null)
            {
                s2 = s1.Split(' ');
                for (int j = 0; j < 50; j++)
                    txtValue[j, i] = float.Parse(s2[j]);
                i++;
                s1 = sr.ReadLine();
            }

            for (int x = 0; x < 50; x++)
                for (int y = 0; y < 41; y++)
                {
                    maparr[x, y] = txtValue[x, y];
                }
            sr.Close();
            fs.Close();

        }

        public void drawmap(Graphics device, int plx, int ply)
        {

            Bitmap bmp2 = new Bitmap("pok/MAP.jpg");
            Bitmap bmp3 = new Bitmap("pok/MAP2.jpg");
            Bitmap bmp4 = new Bitmap("pok/MAP5.png");
            Bitmap bmp5 = new Bitmap("pok/MAP6.png");
            Bitmap bmp6 = new Bitmap("pok/cl.jpg");
            Bitmap bmp7 = new Bitmap("pok/pokemcen.png");
            try
            {
                loading = 0;

                // txtValue陣列是從記事本取得的二維陣列,也就是您要的結果
                /////////////////////
                //繪畫網格方便設定物件
                for (int x = plx - 9; x < plx + 9; x++)
                {
                    for (int y = ply - 9; y < ply + 9; y++)
                    {
                        if (x < 0 || y < 0 || x >= 50 || y >= 40)
                            continue;
                        if (maparr[x, y] == 7)
                        {
                            if (x == plx && y == ply + 1 && maparr[plx, ply + 1] == 7)
                            {
                                device.DrawImage(TakeScreenshot(0, 0, bmp5, 1, 1, 1, 1, 1), x * 40, y * 40);

                            }
                            else
                                device.DrawImage(TakeScreenshot(0, 0, bmp4, 1, 1, 1, 1, 1), x * 40, y * 40);
                        }

                        if (maparr[x, y] == 1)
                        {

                            device.DrawImage(TakeScreenshot(0, 0, bmp6, 1, 1, 1, 1, 2), x * 40, y * 40);

                        }
                        if (maparr[x, y] == 6)
                        {
                            device.DrawImage(TakeScreenshot(0, 0, bmp7, 1, 1, 1, 1, 1.2), x * 40, y * 40);

                        }

                        if (maparr[x, y] == 3)
                        {
                            device.DrawImage(TakeScreenshot(0, 0, bmp3, 1, 1, 1, 1, 2), x * 40, y * 40);
                        }
                        if (y > 1)
                            if (maparr[x, y + 1] == 3 && maparr[x, y - 1] == 3)
                            {
                                tmpx = plx; tmpy = ply + 1;
                                continue;
                            }

                    }

                    //  Pen pen = new Pen(Color.Green);


                }
                loading = 1;
            }
            catch
            { }

        }
        public void drawmap2(Graphics device)
        {
            loading = 0;

                Bitmap bmp3 = new Bitmap("pok/MAP2.jpg");
                for (int i = tmpy; i < tmpy+10; i++)
                {
                if(i<40)
                    if (maparr[tmpx, i] == 3)
                    {
                        device.DrawImage(TakeScreenshot(0, 0, bmp3, 1, 1, 1, 1, 2), tmpx * 40, i * 40);

                    }
                }


            loading = 1;

        }
        public void delatemap()
        {
            maparr = null;
        }
    }

}

class worldmapsprite
{
    Bitmap bmpman = new Bitmap("pok/man.png");
    Bitmap bmpgirl = new Bitmap("pok/girl.png");
    Bitmap bmpt;
    Bitmap bmptmp;
    Random crandom = new Random(Guid.NewGuid().GetHashCode());
    public PictureBox pb1 = new PictureBox();
    Bitmap bmp = new Bitmap("pok/player.png");
    public Point location;
    public Image image;
    int plx = 0;
    int ply = 0;
    int rl = 0;
    int rl2 = 0;
    int race;
    int height;
    int width;
    public int id;
    int back;
    System.Timers.Timer tmr = new System.Timers.Timer(200);
    int cutx = 0, cuty = 0, orx = 0, ory = 0, chx = 0, chy = 0;

    private static Bitmap Process(Bitmap originImage, int oriwidth, int oriheight, int width, int height)
    {
        Bitmap resizedbitmap = new Bitmap(width, height);
        Graphics g = Graphics.FromImage(resizedbitmap);
        g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
        g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
        g.Clear(Color.Transparent);
        g.DrawImage(originImage, new Rectangle(0, 0, width, height), new Rectangle(0, 0, oriwidth, oriheight), GraphicsUnit.Pixel);
        return resizedbitmap;
    }
    public static Bitmap Resize(Bitmap originImage, Double times)
    {
        int width = Convert.ToInt32(originImage.Width * times);
        int height = Convert.ToInt32(originImage.Height * times);

        return Process(originImage, originImage.Width, originImage.Height, width, height);
    }
    public Bitmap TakeScreenshot(int y, int x, Bitmap bmpx, int cutx1, int cutx2, int cuty1, int cuty2, double multiple)
    {
        Bitmap destBitmap = new Bitmap(bmpx.Width, bmpx.Height);
        Rectangle destRect = new Rectangle(0, 0, destBitmap.Width / cutx1, destBitmap.Height / cuty1); // 你的輸出範圍
        Rectangle srcRect = new Rectangle(y, x, bmpx.Width / cutx1, bmpx.Height / cuty2); // 你的原圖剪裁區域
        Graphics.FromImage(destBitmap).DrawImage(bmpx, destRect, srcRect, GraphicsUnit.Pixel);
        return Resize(destBitmap, multiple);
    }


    public Rectangle UPdata()
    {//33 48

        Rectangle p1 = pb1.ClientRectangle;
        pb1.Location = new Point(plx, ply);
        p1.Offset(pb1.Location);
        p1.Location = new Point(location.X, location.Y);

        return p1;
    }
    public void UPdata2(int plxx, int plyy)
    {//33 48
        plx = plxx;
        ply = plyy;
    }
    void MyBackgroundTask()
    {

        Thread.Sleep(20);
    }

    public worldmapsprite(Point location, Image image, int id)
    {
        pb1.Size = new Size(80, 80);
        this.location = location;
        this.image = image;
        this.id = id;
        width = image.Width;
        height = image.Height;
        tmr.Start();
    }
    void UP()
    {//48 64 16
     //player 

        if (race == 1) { cutx = 48; cuty = 0; orx = 3; ory = 3; chy = 4; chx = 4; bmpt = bmp; }
        if (rl == 1)
        {
            image = TakeScreenshot(cutx * 0, cuty, bmpt, orx, ory, chx, chy, 2);
        }
        else if (rl == 0) { image = TakeScreenshot(cutx * 1, cuty, bmpt, orx, ory, chx, chy, 2); }


    }
    void DOWN()
    {

        if (race == 1) { cutx = 48; cuty = 64; orx = 3; ory = 3; chy = 4; chx = 4; bmpt = bmp; }
        if (rl == 1)
        {
            image = TakeScreenshot(cutx * 0, cuty, bmpt, orx, ory, chx, chy, 2);
        }
        else if (rl == 0) { image = TakeScreenshot(cutx * 1, cuty, bmpt, orx, ory, chx, chy, 2); }
    }
    void RIGHT()
    {
        if (race == 1) { cutx = 48; cuty = 16; orx = 3; ory = 3; chy = 4; chx = 4; bmpt = bmp; }
        if (rl == 1)
        {
            image = TakeScreenshot(cutx * 0, cuty * 2, bmpt, orx, ory, chx, chy, 2);
        }
        else if (rl == 0) { image = TakeScreenshot(cutx * 1, cuty * 2, bmpt, orx, ory, chx, chy, 2); }

    }
    void LEFT()
    {
        if (race == 1) { cutx = 48; cuty = 16; orx = 3; ory = 3; chy = 4; chx = 4; bmpt = bmp; }
        if (rl == 1)
        {
            image = TakeScreenshot(cutx * 0, cuty * 6, bmpt, orx, ory, chx, chy, 2);
        }
        else if (rl == 0) { image = TakeScreenshot(cutx * 1, cuty * 6, bmpt, orx, ory, chx, chy, 2); }

    }
    public void look(int face, int id)
    {
        if (id == 2)
            bmptmp = bmpman;

        else if (id == 3)
            bmptmp = bmpgirl;

        if (face == 2)
            image = TakeScreenshot(20, 1, bmptmp, 3, 3, 4, 4, 2);
        else if (face == 3)
            image = TakeScreenshot(21, 32, bmptmp, 3, 3, 4, 4, 2);
        else if (face == 1)
            image = TakeScreenshot(20, 64, bmptmp, 3, 3, 4, 4, 2);
        else if (face == 4)
            image = TakeScreenshot(21, 96, bmptmp, 3, 3, 4, 4, 2);
    }
    public void move(int face, int id, int times, int touch)
    {
        if (rl2 == 0) { rl2 = 1; }
        else if (rl2 == 1)
        { rl2 = 0; }
        if (id == 2)
            bmptmp = bmpman;

        else if (id == 3)
            bmptmp = bmpgirl;


        if (face == 1)
        {
            location.Y += 40;
            if (rl2 == 0)
                image = TakeScreenshot(1, 64, bmptmp, 3, 3, 4, 4, 2);
            else if (rl2 == 1)
            {
                image = TakeScreenshot(45, 64, bmptmp, 3, 3, 4, 4, 2);

            }


        }

        else if (face == 2)
        {

            location.Y -= 40;
            if (rl2 == 0)
                image = TakeScreenshot(1, 1, bmptmp, 3, 3, 4, 4, 2);
            else if (rl2 == 1)
            {
                image = TakeScreenshot(45, 1, bmptmp, 3, 3, 4, 4, 2);

            }



        }
        else if (face == 3)
        {
            location.X -= 40;
            if (rl2 == 0)

                image = TakeScreenshot(1, 96, bmptmp, 3, 3, 4, 4, 2);
            else if (rl2 == 1)
            {
                image = TakeScreenshot(45, 96, bmptmp, 3, 3, 4, 4, 2);
            }



        }
        else if (face == 4)

        {
            location.X += 40;
            if (rl2 == 0)
                image = TakeScreenshot(1, 32, bmptmp, 3, 3, 4, 4, 2);


            else if (rl2 == 1)
            {
                image = TakeScreenshot(45, 32, bmptmp, 3, 3, 4, 4, 2);
            }



        }



    }

    public void move(int x, int y, KeyEventArgs e, int inrace, int face)
    {
        GC.Collect();//清除new物件 重要會吃記憶體

        race = inrace;

        if (e.KeyCode == Keys.Up)
        {
            UP();
            if (rl == 0) { rl = 1; }
            else if (rl == 1)
            { rl = 0; }


        }
        else if (e.KeyCode == Keys.Down)
        {
            DOWN();
            if (rl == 1) { rl = 0; }
            else if (rl == 0)
            { rl = 1; }


        }
        else if (e.KeyCode == Keys.Left)
        {
            LEFT();
            if (rl == 0) { rl = 1; }
            else if (rl == 1)
            { rl = 0; }
        }
        else if (e.KeyCode == Keys.Right)
        {
            RIGHT();
            if (rl == 0) { rl = 1; }
            else if (rl == 1)
            { rl = 0; }

        }

        back = face;
        if (back == 5)
        { cutx = 48; cuty = 16; orx = 3; ory = 3; chy = 4; chx = 4; bmpt = bmp; image = TakeScreenshot(20, cuty * 2, bmpt, orx, ory, chx, chy, 2); }
        else if (back == 6)
        { cutx = 48; cuty = 0; orx = 3; ory = 3; chy = 4; chx = 4; bmpt = bmp; image = TakeScreenshot(20, cuty, bmpt, orx, ory, chx, chy, 2); }
        else if (back == 7)
        { cutx = 48; cuty = 16; orx = 3; ory = 3; chy = 4; chx = 4; bmpt = bmp; image = TakeScreenshot(20, cuty * 6, bmpt, orx, ory, chx, chy, 2); }
        else if (back == 8)
        { cutx = 48; cuty = 16; orx = 3; ory = 3; chy = 4; chx = 4; bmpt = bmp; bmpt = bmp; image = TakeScreenshot(20, cuty * 4, bmpt, orx, ory, chx, chy, 2); }
        pb1.Location = new Point(x, y);
        location.X = x;
        location.Y = y;
    }

    public void draw(Graphics device)
    {
        try
        {

            device.DrawImage(image, location);
        }
        catch { }
    }
    public void draw2(Graphics device, int plx, int ply)
    {


            device.DrawImage(image, plx, ply);

    }


    public PictureBoxSizeMode StretchImage { get; set; }
}

class worldmapmonster : worldmapsprite
{
    public bool isstatic;
    public worldmapmonster(Point location, Image image, int id)
        : base(location, image, id)
    {
        isstatic = true;
    }
}

class Playerparty
{
    public worldmapsprite partsprite;
    public Playerparty(Point location, Image image, int id)
    {
        partsprite = new worldmapsprite(location, image, id);
    }

}

C#:2DRPG engine_Class2.cs

csharp
using System;
using System.Collections.Generic;
//using System.Linq;
using System.Text;
using System.Data;

using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WindowsFormsApplication1
{
    public class MP3Player
    {
        public void Play(string FilePath)
        {
            mciSendString("close all", "", 0, 0);
            mciSendString("open " + FilePath + " alias media", "", 0, 0);
            mciSendString("play media", "", 0, 0);
        }
        public void Pause()
        {
            mciSendString("pause media", "", 0, 0);
        }
        public void Stop()
        {
            mciSendString("close media", "", 0, 0);
        }
        [DllImport("winmm.dll", EntryPoint = "mciSendString", CharSet = CharSet.Auto)]
        private static extern int mciSendString(
         string lpstrCommand,
         string lpstrReturnString,
         int uReturnLength,
         int hwndCallback
        );
    }
}

CombatGUI.Designer.cs

csharp
namespace WindowsFormsApplication1
{
    partial class CombatGUI
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CombatGUI));
            this.enemyAttackTimer = new System.Windows.Forms.Timer(this.components);
            this.Playerattacttimer = new System.Windows.Forms.Timer(this.components);
            this.progressBar1 = new System.Windows.Forms.ProgressBar();
            this.progressBar2 = new System.Windows.Forms.ProgressBar();
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.timer1 = new System.Windows.Forms.Timer(this.components);
            this.wmp = new AxWMPLib.AxWindowsMediaPlayer();
            this.wmp2 = new AxWMPLib.AxWindowsMediaPlayer();
            this.radioButton1 = new System.Windows.Forms.RadioButton();
            this.radioButton2 = new System.Windows.Forms.RadioButton();
            this.radioButton3 = new System.Windows.Forms.RadioButton();
            this.radioButton4 = new System.Windows.Forms.RadioButton();
            this.wmp3 = new AxWMPLib.AxWindowsMediaPlayer();
            this.wmp4 = new AxWMPLib.AxWindowsMediaPlayer();
            this.timer2 = new System.Windows.Forms.Timer(this.components);
            this.label3 = new System.Windows.Forms.Label();
            this.timer3 = new System.Windows.Forms.Timer(this.components);
            this.timer4 = new System.Windows.Forms.Timer(this.components);
            this.timer5 = new System.Windows.Forms.Timer(this.components);
            this.timer6 = new System.Windows.Forms.Timer(this.components);
            this.label4 = new System.Windows.Forms.Label();
            this.timer7 = new System.Windows.Forms.Timer(this.components);
            this.timer8 = new System.Windows.Forms.Timer(this.components);
            this.timer9 = new System.Windows.Forms.Timer(this.components);
            this.wmp5 = new AxWMPLib.AxWindowsMediaPlayer();
            this.timer10 = new System.Windows.Forms.Timer(this.components);
            this.radioButton5 = new System.Windows.Forms.RadioButton();
            this.radioButton6 = new System.Windows.Forms.RadioButton();
            this.radioButton7 = new System.Windows.Forms.RadioButton();
            this.radioButton8 = new System.Windows.Forms.RadioButton();
            this.pictureBox11 = new System.Windows.Forms.PictureBox();
            this.pictureBox3 = new System.Windows.Forms.PictureBox();
            this.PartyPB1 = new System.Windows.Forms.PictureBox();
            this.EnemyPB1 = new System.Windows.Forms.PictureBox();
            this.pictureBox5 = new System.Windows.Forms.PictureBox();
            this.pictureBox6 = new System.Windows.Forms.PictureBox();
            this.pictureBox10 = new System.Windows.Forms.PictureBox();
            this.pictureBox7 = new System.Windows.Forms.PictureBox();
            this.pictureBox8 = new System.Windows.Forms.PictureBox();
            this.pictureBox9 = new System.Windows.Forms.PictureBox();
            this.pictureBox4 = new System.Windows.Forms.PictureBox();
            this.pictureBox1 = new System.Windows.Forms.PictureBox();
            this.pictureBox2 = new System.Windows.Forms.PictureBox();
            this.button1 = new System.Windows.Forms.Button();
            ((System.ComponentModel.ISupportInitialize)(this.wmp)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.wmp2)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.wmp3)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.wmp4)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.wmp5)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox11)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.PartyPB1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.EnemyPB1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox10)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox8)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox9)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
            this.SuspendLayout();
            // 
            // enemyAttackTimer
            // 
            this.enemyAttackTimer.Tick += new System.EventHandler(this.enemyAttackTimer_Tick_1);
            // 
            // Playerattacttimer
            // 
            this.Playerattacttimer.Tick += new System.EventHandler(this.Playerattacttimer_Tick);
            // 
            // progressBar1
            // 
            this.progressBar1.Location = new System.Drawing.Point(119, 57);
            this.progressBar1.Name = "progressBar1";
            this.progressBar1.Size = new System.Drawing.Size(200, 10);
            this.progressBar1.TabIndex = 10;
            // 
            // progressBar2
            // 
            this.progressBar2.Location = new System.Drawing.Point(497, 409);
            this.progressBar2.Name = "progressBar2";
            this.progressBar2.Size = new System.Drawing.Size(198, 10);
            this.progressBar2.TabIndex = 11;
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.BackColor = System.Drawing.Color.Transparent;
            this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label1.ForeColor = System.Drawing.Color.Red;
            this.label1.Location = new System.Drawing.Point(155, 9);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(91, 25);
            this.label1.TabIndex = 12;
            this.label1.Text = "Enermy";
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.BackColor = System.Drawing.Color.Transparent;
            this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label2.ForeColor = System.Drawing.Color.Black;
            this.label2.Location = new System.Drawing.Point(331, 343);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(101, 33);
            this.label2.TabIndex = 13;
            this.label2.Text = "player";
            // 
            // timer1
            // 
            this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
            // 
            // wmp
            // 
            this.wmp.Enabled = true;
            this.wmp.Location = new System.Drawing.Point(719, 304);
            this.wmp.Name = "wmp";
            this.wmp.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("wmp.OcxState")));
            this.wmp.Size = new System.Drawing.Size(75, 23);
            this.wmp.TabIndex = 16;
            this.wmp.Visible = false;
            this.wmp.StatusChange += new System.EventHandler(this.wmp_StatusChange);
            // 
            // wmp2
            // 
            this.wmp2.Enabled = true;
            this.wmp2.Location = new System.Drawing.Point(719, 275);
            this.wmp2.Name = "wmp2";
            this.wmp2.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("wmp2.OcxState")));
            this.wmp2.Size = new System.Drawing.Size(75, 23);
            this.wmp2.TabIndex = 18;
            this.wmp2.Visible = false;
            // 
            // radioButton1
            // 
            this.radioButton1.AutoSize = true;
            this.radioButton1.BackColor = System.Drawing.Color.Transparent;
            this.radioButton1.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.radioButton1.Location = new System.Drawing.Point(515, 504);
            this.radioButton1.Name = "radioButton1";
            this.radioButton1.Size = new System.Drawing.Size(88, 35);
            this.radioButton1.TabIndex = 19;
            this.radioButton1.TabStop = true;
            this.radioButton1.Text = "ATK";
            this.radioButton1.UseVisualStyleBackColor = false;
            this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged);
            // 
            // radioButton2
            // 
            this.radioButton2.AutoSize = true;
            this.radioButton2.BackColor = System.Drawing.Color.Transparent;
            this.radioButton2.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.radioButton2.Location = new System.Drawing.Point(633, 504);
            this.radioButton2.Name = "radioButton2";
            this.radioButton2.Size = new System.Drawing.Size(115, 35);
            this.radioButton2.TabIndex = 20;
            this.radioButton2.TabStop = true;
            this.radioButton2.Text = "PKMO";
            this.radioButton2.UseVisualStyleBackColor = false;
            this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged);
            // 
            // radioButton3
            // 
            this.radioButton3.AutoSize = true;
            this.radioButton3.BackColor = System.Drawing.Color.Transparent;
            this.radioButton3.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.radioButton3.Location = new System.Drawing.Point(515, 570);
            this.radioButton3.Name = "radioButton3";
            this.radioButton3.Size = new System.Drawing.Size(92, 35);
            this.radioButton3.TabIndex = 21;
            this.radioButton3.TabStop = true;
            this.radioButton3.Text = "BAG";
            this.radioButton3.UseVisualStyleBackColor = false;
            this.radioButton3.CheckedChanged += new System.EventHandler(this.radioButton3_CheckedChanged);
            // 
            // radioButton4
            // 
            this.radioButton4.AutoSize = true;
            this.radioButton4.BackColor = System.Drawing.Color.Transparent;
            this.radioButton4.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.radioButton4.Location = new System.Drawing.Point(633, 570);
            this.radioButton4.Name = "radioButton4";
            this.radioButton4.Size = new System.Drawing.Size(95, 35);
            this.radioButton4.TabIndex = 22;
            this.radioButton4.TabStop = true;
            this.radioButton4.Text = "RUN";
            this.radioButton4.UseVisualStyleBackColor = false;
            this.radioButton4.CheckedChanged += new System.EventHandler(this.radioButton4_CheckedChanged);
            // 
            // wmp3
            // 
            this.wmp3.Enabled = true;
            this.wmp3.Location = new System.Drawing.Point(626, 277);
            this.wmp3.Name = "wmp3";
            this.wmp3.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("wmp3.OcxState")));
            this.wmp3.Size = new System.Drawing.Size(75, 23);
            this.wmp3.TabIndex = 23;
            this.wmp3.Visible = false;
            // 
            // wmp4
            // 
            this.wmp4.Enabled = true;
            this.wmp4.Location = new System.Drawing.Point(626, 304);
            this.wmp4.Name = "wmp4";
            this.wmp4.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("wmp4.OcxState")));
            this.wmp4.Size = new System.Drawing.Size(75, 23);
            this.wmp4.TabIndex = 25;
            this.wmp4.Visible = false;
            // 
            // timer2
            // 
            this.timer2.Interval = 1000;
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(759, 406);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(35, 13);
            this.label3.TabIndex = 26;
            this.label3.Text = "label3";
            // 
            // timer3
            // 
            this.timer3.Interval = 3000;
            this.timer3.Tick += new System.EventHandler(this.timer3_Tick);
            // 
            // timer4
            // 
            this.timer4.Interval = 3000;
            // 
            // timer5
            // 
            this.timer5.Interval = 3000;
            // 
            // timer6
            // 
            this.timer6.Interval = 3000;
            // 
            // label4
            // 
            this.label4.AutoSize = true;
            this.label4.BackColor = System.Drawing.SystemColors.Control;
            this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label4.Location = new System.Drawing.Point(24, 504);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(0, 31);
            this.label4.TabIndex = 33;
            // 
            // timer7
            // 
            this.timer7.Tick += new System.EventHandler(this.timer7_Tick);
            // 
            // timer8
            // 
            this.timer8.Tick += new System.EventHandler(this.timer8_Tick);
            // 
            // timer9
            // 
            this.timer9.Interval = 5;
            this.timer9.Tick += new System.EventHandler(this.timer9_Tick);
            // 
            // wmp5
            // 
            this.wmp5.Enabled = true;
            this.wmp5.Location = new System.Drawing.Point(626, 333);
            this.wmp5.Name = "wmp5";
            this.wmp5.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("wmp5.OcxState")));
            this.wmp5.Size = new System.Drawing.Size(75, 23);
            this.wmp5.TabIndex = 37;
            this.wmp5.Visible = false;
            // 
            // timer10
            // 
            this.timer10.Interval = 5;
            this.timer10.Tick += new System.EventHandler(this.timer10_Tick);
            // 
            // radioButton5
            // 
            this.radioButton5.AutoSize = true;
            this.radioButton5.BackColor = System.Drawing.Color.Transparent;
            this.radioButton5.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.radioButton5.Location = new System.Drawing.Point(49, 515);
            this.radioButton5.Name = "radioButton5";
            this.radioButton5.Size = new System.Drawing.Size(108, 35);
            this.radioButton5.TabIndex = 42;
            this.radioButton5.TabStop = true;
            this.radioButton5.Text = "Strike";
            this.radioButton5.UseVisualStyleBackColor = false;
            this.radioButton5.Visible = false;
            this.radioButton5.CheckedChanged += new System.EventHandler(this.radioButton5_CheckedChanged);
            // 
            // radioButton6
            // 
            this.radioButton6.AutoSize = true;
            this.radioButton6.BackColor = System.Drawing.Color.Transparent;
            this.radioButton6.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.radioButton6.Location = new System.Drawing.Point(294, 515);
            this.radioButton6.Name = "radioButton6";
            this.radioButton6.Size = new System.Drawing.Size(121, 35);
            this.radioButton6.TabIndex = 43;
            this.radioButton6.TabStop = true;
            this.radioButton6.Text = "Poison";
            this.radioButton6.UseVisualStyleBackColor = false;
            this.radioButton6.Visible = false;
            this.radioButton6.CheckedChanged += new System.EventHandler(this.radioButton6_CheckedChanged);
            // 
            // radioButton7
            // 
            this.radioButton7.AutoSize = true;
            this.radioButton7.BackColor = System.Drawing.Color.Transparent;
            this.radioButton7.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.radioButton7.Location = new System.Drawing.Point(49, 570);
            this.radioButton7.Name = "radioButton7";
            this.radioButton7.Size = new System.Drawing.Size(127, 35);
            this.radioButton7.TabIndex = 44;
            this.radioButton7.TabStop = true;
            this.radioButton7.Text = "electric";
            this.radioButton7.UseVisualStyleBackColor = false;
            this.radioButton7.Visible = false;
            this.radioButton7.CheckedChanged += new System.EventHandler(this.radioButton7_CheckedChanged);
            // 
            // radioButton8
            // 
            this.radioButton8.AutoSize = true;
            this.radioButton8.BackColor = System.Drawing.Color.Transparent;
            this.radioButton8.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.radioButton8.Location = new System.Drawing.Point(294, 570);
            this.radioButton8.Name = "radioButton8";
            this.radioButton8.Size = new System.Drawing.Size(163, 35);
            this.radioButton8.TabIndex = 45;
            this.radioButton8.TabStop = true;
            this.radioButton8.Text = "Hypnotize";
            this.radioButton8.UseVisualStyleBackColor = false;
            this.radioButton8.Visible = false;
            this.radioButton8.CheckedChanged += new System.EventHandler(this.radioButton8_CheckedChanged);
            // 
            // pictureBox11
            // 
            this.pictureBox11.BackColor = System.Drawing.Color.White;
            this.pictureBox11.Location = new System.Drawing.Point(294, 9);
            this.pictureBox11.Name = "pictureBox11";
            this.pictureBox11.Size = new System.Drawing.Size(25, 24);
            this.pictureBox11.TabIndex = 46;
            this.pictureBox11.TabStop = false;
            // 
            // pictureBox3
            // 
            this.pictureBox3.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox3.Image")));
            this.pictureBox3.Location = new System.Drawing.Point(2, 485);
            this.pictureBox3.Name = "pictureBox3";
            this.pictureBox3.Size = new System.Drawing.Size(489, 159);
            this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.pictureBox3.TabIndex = 31;
            this.pictureBox3.TabStop = false;
            // 
            // PartyPB1
            // 
            this.PartyPB1.BackColor = System.Drawing.Color.Transparent;
            this.PartyPB1.Location = new System.Drawing.Point(68, 328);
            this.PartyPB1.Name = "PartyPB1";
            this.PartyPB1.Size = new System.Drawing.Size(178, 249);
            this.PartyPB1.TabIndex = 4;
            this.PartyPB1.TabStop = false;
            // 
            // EnemyPB1
            // 
            this.EnemyPB1.BackColor = System.Drawing.Color.Transparent;
            this.EnemyPB1.Location = new System.Drawing.Point(578, 43);
            this.EnemyPB1.Name = "EnemyPB1";
            this.EnemyPB1.Size = new System.Drawing.Size(178, 249);
            this.EnemyPB1.TabIndex = 5;
            this.EnemyPB1.TabStop = false;
            // 
            // pictureBox5
            // 
            this.pictureBox5.BackColor = System.Drawing.Color.MediumSeaGreen;
            this.pictureBox5.Location = new System.Drawing.Point(130, 41);
            this.pictureBox5.Name = "pictureBox5";
            this.pictureBox5.Size = new System.Drawing.Size(200, 10);
            this.pictureBox5.TabIndex = 34;
            this.pictureBox5.TabStop = false;
            // 
            // pictureBox6
            // 
            this.pictureBox6.BackColor = System.Drawing.SystemColors.ButtonFace;
            this.pictureBox6.Location = new System.Drawing.Point(130, 41);
            this.pictureBox6.Name = "pictureBox6";
            this.pictureBox6.Size = new System.Drawing.Size(200, 10);
            this.pictureBox6.TabIndex = 35;
            this.pictureBox6.TabStop = false;
            // 
            // pictureBox10
            // 
            this.pictureBox10.Image = global::pokemon.Properties.Resources.battleen;
            this.pictureBox10.Location = new System.Drawing.Point(-11, 2);
            this.pictureBox10.Name = "pictureBox10";
            this.pictureBox10.Size = new System.Drawing.Size(361, 93);
            this.pictureBox10.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.pictureBox10.TabIndex = 41;
            this.pictureBox10.TabStop = false;
            // 
            // pictureBox7
            // 
            this.pictureBox7.BackColor = System.Drawing.Color.MediumSeaGreen;
            this.pictureBox7.Location = new System.Drawing.Point(515, 389);
            this.pictureBox7.Name = "pictureBox7";
            this.pictureBox7.Size = new System.Drawing.Size(200, 10);
            this.pictureBox7.TabIndex = 38;
            this.pictureBox7.TabStop = false;
            // 
            // pictureBox8
            // 
            this.pictureBox8.BackColor = System.Drawing.SystemColors.ButtonFace;
            this.pictureBox8.Location = new System.Drawing.Point(515, 389);
            this.pictureBox8.Name = "pictureBox8";
            this.pictureBox8.Size = new System.Drawing.Size(200, 10);
            this.pictureBox8.TabIndex = 39;
            this.pictureBox8.TabStop = false;
            // 
            // pictureBox9
            // 
            this.pictureBox9.Image = global::pokemon.Properties.Resources.battleme;
            this.pictureBox9.Location = new System.Drawing.Point(272, 333);
            this.pictureBox9.Name = "pictureBox9";
            this.pictureBox9.Size = new System.Drawing.Size(487, 146);
            this.pictureBox9.TabIndex = 40;
            this.pictureBox9.TabStop = false;
            // 
            // pictureBox4
            // 
            this.pictureBox4.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox4.Image")));
            this.pictureBox4.Location = new System.Drawing.Point(497, 485);
            this.pictureBox4.Name = "pictureBox4";
            this.pictureBox4.Size = new System.Drawing.Size(262, 159);
            this.pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.pictureBox4.TabIndex = 32;
            this.pictureBox4.TabStop = false;
            // 
            // pictureBox1
            // 
            this.pictureBox1.BackColor = System.Drawing.Color.White;
            this.pictureBox1.ImageLocation = "gameover.png";
            this.pictureBox1.Location = new System.Drawing.Point(-1, 0);
            this.pictureBox1.Name = "pictureBox1";
            this.pictureBox1.Size = new System.Drawing.Size(778, 655);
            this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.pictureBox1.TabIndex = 17;
            this.pictureBox1.TabStop = false;
            this.pictureBox1.Visible = false;
            // 
            // pictureBox2
            // 
            this.pictureBox2.BackColor = System.Drawing.Color.Transparent;
            this.pictureBox2.Location = new System.Drawing.Point(0, 0);
            this.pictureBox2.Name = "pictureBox2";
            this.pictureBox2.Size = new System.Drawing.Size(777, 327);
            this.pictureBox2.TabIndex = 24;
            this.pictureBox2.TabStop = false;
            // 
            // button1
            // 
            this.button1.Location = new System.Drawing.Point(673, 545);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(75, 23);
            this.button1.TabIndex = 47;
            this.button1.Text = "button1";
            this.button1.UseVisualStyleBackColor = true;
            // 
            // CombatGUI
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.BackColor = System.Drawing.SystemColors.ButtonFace;
            this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
            this.ClientSize = new System.Drawing.Size(776, 653);
            this.Controls.Add(this.pictureBox11);
            this.Controls.Add(this.radioButton8);
            this.Controls.Add(this.radioButton7);
            this.Controls.Add(this.radioButton6);
            this.Controls.Add(this.radioButton5);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.pictureBox3);
            this.Controls.Add(this.PartyPB1);
            this.Controls.Add(this.EnemyPB1);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.progressBar1);
            this.Controls.Add(this.pictureBox5);
            this.Controls.Add(this.pictureBox6);
            this.Controls.Add(this.pictureBox10);
            this.Controls.Add(this.pictureBox7);
            this.Controls.Add(this.pictureBox8);
            this.Controls.Add(this.progressBar2);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.pictureBox9);
            this.Controls.Add(this.wmp5);
            this.Controls.Add(this.radioButton3);
            this.Controls.Add(this.radioButton4);
            this.Controls.Add(this.radioButton2);
            this.Controls.Add(this.radioButton1);
            this.Controls.Add(this.pictureBox4);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.wmp4);
            this.Controls.Add(this.wmp3);
            this.Controls.Add(this.wmp2);
            this.Controls.Add(this.wmp);
            this.Controls.Add(this.pictureBox1);
            this.Controls.Add(this.pictureBox2);
            this.Controls.Add(this.button1);
            this.DoubleBuffered = true;
            this.KeyPreview = true;
            this.Name = "CombatGUI";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "CombatGUI";
            this.Load += new System.EventHandler(this.CombatGUI_Load);
            this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.CombatGUI_KeyDown);
            ((System.ComponentModel.ISupportInitialize)(this.wmp)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.wmp2)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.wmp3)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.wmp4)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.wmp5)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox11)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.PartyPB1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.EnemyPB1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox10)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox8)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox9)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Timer enemyAttackTimer;
        private System.Windows.Forms.Timer Playerattacttimer;
        private System.Windows.Forms.PictureBox PartyPB1;
        private System.Windows.Forms.PictureBox EnemyPB1;
        private System.Windows.Forms.ProgressBar progressBar1;
        private System.Windows.Forms.ProgressBar progressBar2;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Timer timer1;
        private AxWMPLib.AxWindowsMediaPlayer wmp;
        private System.Windows.Forms.PictureBox pictureBox1;
        private AxWMPLib.AxWindowsMediaPlayer wmp2;
        private System.Windows.Forms.RadioButton radioButton1;
        private System.Windows.Forms.RadioButton radioButton2;
        private System.Windows.Forms.RadioButton radioButton3;
        private System.Windows.Forms.RadioButton radioButton4;
        private AxWMPLib.AxWindowsMediaPlayer wmp3;
        private System.Windows.Forms.PictureBox pictureBox2;
        private AxWMPLib.AxWindowsMediaPlayer wmp4;
        private System.Windows.Forms.Timer timer2;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Timer timer3;
        private System.Windows.Forms.Timer timer4;
        private System.Windows.Forms.Timer timer5;
        private System.Windows.Forms.Timer timer6;
        private System.Windows.Forms.PictureBox pictureBox3;
        private System.Windows.Forms.PictureBox pictureBox4;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.Timer timer7;
        private System.Windows.Forms.Timer timer8;
        private System.Windows.Forms.PictureBox pictureBox5;
        private System.Windows.Forms.PictureBox pictureBox6;
        private System.Windows.Forms.Timer timer9;
        private AxWMPLib.AxWindowsMediaPlayer wmp5;
        private System.Windows.Forms.PictureBox pictureBox7;
        private System.Windows.Forms.PictureBox pictureBox8;
        private System.Windows.Forms.Timer timer10;
        private System.Windows.Forms.PictureBox pictureBox9;
        private System.Windows.Forms.PictureBox pictureBox10;
        private System.Windows.Forms.RadioButton radioButton5;
        private System.Windows.Forms.RadioButton radioButton6;
        private System.Windows.Forms.RadioButton radioButton7;
        private System.Windows.Forms.RadioButton radioButton8;
        private System.Windows.Forms.PictureBox pictureBox11;
        private System.Windows.Forms.Button button1;
    }
}

CombatGUI.cs

csharp
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
//using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.Runtime.InteropServices;
using WMPLib;
using System.IO;
namespace WindowsFormsApplication1
{
    public partial class CombatGUI : Form
    {
        int Poison = 3;
        MP3Player back = new MP3Player();
        public Bitmap bmplayer3 = new Bitmap("pok/2.png");
        public Bitmap bmplayer4 = new Bitmap("pok/1.png");
        public string now_monname;
        int catching;
        public int train = 0;
        int enhp = (2000 / 200);
        int plhp = (2000 / 200);
        int plattack_now = 0;
        int plattack = 0;
        int enattack_now = 0;
        int enattack = 0;
        public int time;
        public int win;
        public int outside;
        public double tmpx;
        public double tmpy;
        public int enytmpx;
        public int enytmpy;
        int catcho;
        int sleeptime = 0;
        int sh1;
        int sh2;
        public int over = 0;
        int locked = 0;
        public int over2()
        {
            return over;
        }
        void MyBackgroundTask()
        {
            radioButton1.Enabled = false;
            radioButton2.Enabled = false;
            radioButton3.Enabled = false;
            radioButton4.Enabled = false;

            Thread.Sleep(20000);

            Environment.Exit(Environment.ExitCode);
        }
        public string backroundsound;

        public Bitmap f1, f2;

        public CombatGUI()
        {

            InitializeComponent();

        }


        private static Bitmap Process(Bitmap originImage, int oriwidth, int oriheight, int width, int height)
        {
            Bitmap resizedbitmap = new Bitmap(width, height);
            Graphics g = Graphics.FromImage(resizedbitmap);
            g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            g.Clear(Color.Transparent);
            g.DrawImage(originImage, new Rectangle(0, 0, width, height), new Rectangle(0, 0, oriwidth, oriheight), GraphicsUnit.Pixel);
            return resizedbitmap;
        }
        public static Bitmap Resize(Bitmap originImage, Double times)
        {
            int width = Convert.ToInt32(originImage.Width * times);
            int height = Convert.ToInt32(originImage.Height * times);

            return Process(originImage, originImage.Width, originImage.Height, width, height);
        }
        public Bitmap TakeScreenshot(int y, int x, Bitmap bmpx, int cutx1, int cutx2, int cuty1, int cuty2, double multiple)
        {
            Bitmap destBitmap = new Bitmap(bmpx.Width, bmpx.Height);
            Rectangle destRect = new Rectangle(0, 0, destBitmap.Width / cutx1, destBitmap.Height / cuty1); // 你的輸出範圍
            Rectangle srcRect = new Rectangle(y, x, bmpx.Width / cutx1, bmpx.Height / cuty2); // 你的原圖剪裁區域
            Graphics.FromImage(destBitmap).DrawImage(bmpx, destRect, srcRect, GraphicsUnit.Pixel);
            return Resize(destBitmap, multiple);
        }
        private void CombatGUI_KeyDown(object sender, KeyEventArgs e)
        {

            switch (e.KeyCode)
            {
                case Keys.Z:

                    if (locked == 1 && catching == 0)
                    {

                        change_if();



                    }



                    break;

                    /*     case Keys.Down:
                             radioButton1.Focus();
                             radioButton5.Focus();
                             break;
                         case Keys.Up:
                             radioButton4.Focus();
                             radioButton8.Focus();
                             break;*/
            }
        }

        void MyBackgroundTask2()
        {
            Thread.Sleep(sleeptime);
        }

        private void CombatGUI_Load(object sender, EventArgs e)
        {

            // 初始化画板
            Bitmap image = new Bitmap(pictureBox1.ClientSize.Width, pictureBox1.ClientSize.Height);
            // 获取背景层
            Bitmap bg = (Bitmap)pictureBox1.BackgroundImage;
            Bitmap bmplayer2 = new Bitmap("pok/ball.png");
            // 初始化画布
            Bitmap canvas = new Bitmap(pictureBox1.ClientSize.Width, pictureBox1.ClientSize.Height);

            // 初始化图形面板
            Graphics g = Graphics.FromImage(image);
            Graphics gb = Graphics.FromImage(canvas);
            pictureBox2.BackgroundImage = canvas; // 设置为背景层
            pictureBox2.CreateGraphics().DrawImage(canvas, 0, 0);
            bg = new Bitmap("pok/back.png");

            DRAWIMAGEXX(gb, TakeScreenshot(0, 0, bmplayer3, 1, 1, 1, 1, 2), EnemyPB1.Location.X, EnemyPB1.Location.Y, 1, 1);

            this.Focus();

            wmp2.URL = "sound/battle.mp3";
            wmp2.Ctlcontrols.play();


            PartyPB1.Image = f1;
            EnemyPB1.Image = f2;
            enytmpx = EnemyPB1.Location.X;
            enytmpy = EnemyPB1.Location.Y;

            //  ModifyProgressBarColor.SetState(progressBar1, 3);
            //        ModifyProgressBarColor.SetState(progressBar2, 3);
            //   ModifyProgressBarColor.SetState(progressBar3, 1);
            //  ModifyProgressBarColor.SetState(progressBar4, 1);

            enemyAttackTimer.Enabled = true;
            Playerattacttimer.Enabled = true;
            if (train == 1)
                radioButton2.Enabled = false;
            else
                radioButton2.Enabled = true;
            locked = 1;
            label4.Text = "what to do now?";
            check_pok();
        }


        private void enemyAttackTimer_Tick_1(object sender, EventArgs e)
        {



        }



        private void Playerattacttimer_Tick(object sender, EventArgs e)
        {


        }



       void change_if()
        {
            Random crandom = new Random(Guid.NewGuid().GetHashCode());
            int crit = crandom.Next(1, 10);
            int crit2 = crandom.Next(1, 100);

            if (radioButton1.Checked == true)
            {
                label4.Visible = false;
                radioButton1.Enabled = false;
                radioButton2.Enabled = false;
                radioButton3.Enabled = false;
                radioButton4.Enabled = false;

                radioButton5.Visible = true;
                radioButton6.Visible = true;
                radioButton7.Visible = true;
                radioButton8.Visible = true;
                locked = 0;


            }
            else if (radioButton5.Checked == true || radioButton6.Checked == true)
            {


                ///////////////////////////////////////////////////////////////////
                if (crit < 2)
                {
                    wmp3.URL = "sound/lit.wav";
                    label4.Text = "Player attack!";
                }
                if (crit >= 2 && crit < 8)
                {
                    wmp3.URL = "sound/knf.wav";
                    label4.Text = "Player attack!";
                }
                if (crit >= 9)
                {
                    wmp3.URL = "sound/cr.wav";
                    label4.Text = "Player Crit attack!";
                }
                if (crit >= 6)
                    if (radioButton6.Checked == true)
                    {
                        wmp3.URL = "sound/cr.wav";
                        timer3.Enabled = false;
                    }

                wmp3.Ctlcontrols.play();

                attack(enhp, crit, 1);
                timer7.Enabled = true;
                ///////////////////////////////////////////////////////////////////
                //   cmbSkill.Items.Add("Player attack!" ;
                label4.Visible = true;


                radioButton5.Visible = false;
                radioButton6.Visible = false;
                radioButton7.Visible = false;
                radioButton8.Visible = false;

                locked = 0;
            }
            else if (radioButton2.Checked == true)
            {
                enemyAttackTimer.Enabled = false;
                Playerattacttimer.Enabled = false;


                label4.Text = "丟出大師球";
                this.Refresh();
                pokeball();
            }
            else if (radioButton4.Checked == true)
            {
                enemyAttackTimer.Enabled = false;
                Playerattacttimer.Enabled = false;
                if (crit2 > 30)
                {
                    stop();
                    outside = 1;
                    wmp3.URL = "sound/out.wav";
                    wmp3.Ctlcontrols.play();

                    label4.Text = "逃跑成功!!";

                }
                else
                {
                    enemyAttackTimer.Enabled = true;
                    Playerattacttimer.Enabled = true;
                    wmp3.URL = "sound/out.wav";
                    wmp3.Ctlcontrols.play();

                    label4.Text = "逃跑失敗!!";
                    enyattack();

                }
            }


        }





        private void wmp_StatusChange(object sender, EventArgs e)
        {
            /*     if ((int)wmp.playState == 1)//如果播放状态等于停止
                 {
                     if (start == 0)
                     {
                         enemyAttackTimer.Enabled = true;
                         Playerattacttimer.Enabled = true;
                         wmp2.URL = "battle.mp3";
                         wmp2.Ctlcontrols.play(); //这里写你的处理代码
                         start = 1;
                     }
                 }*/
        }

        void pokeball()
        {

            // 初始化画板
            Bitmap image = new Bitmap(pictureBox1.ClientSize.Width, pictureBox1.ClientSize.Height);
            MP3Player mp3 = new MP3Player();
            // 获取背景层
            Bitmap bg = (Bitmap)pictureBox1.BackgroundImage;
            Bitmap bmplayer2 = new Bitmap("pok/ball.png");

            // 初始化画布
            Bitmap canvas = new Bitmap(pictureBox1.ClientSize.Width, pictureBox1.ClientSize.Height);

            // 初始化图形面板
            Graphics g = Graphics.FromImage(image);
            Graphics gb = Graphics.FromImage(canvas);
            catching = 1;
            radioButton1.Enabled = false;
            radioButton2.Enabled = false;
            radioButton3.Enabled = false;
            radioButton4.Enabled = false;
            pictureBox2.BackgroundImage = canvas; // 设置为背景层
            pictureBox2.CreateGraphics().DrawImage(canvas, 0, 0);
            bg = new Bitmap("pok/back.png");
            double t;
            int xxx = 0;
            back.Play("sound/throw.wav");

            for (t = -5; t < 2; t = t + 0.2)
            {

                double x = xx(2.5 * t, 500);
                double y = yy(3 * t, 0);

                DRAWIMAGEXX(gb, TakeScreenshot(0, xxx, bmplayer2, 17, 17, 17, 17, 1.5), Convert.ToInt32(x), Convert.ToInt32(y), 1, 1);

                if (y < 300 && x > 450)
                {
                    tmpx = x + 10;
                    tmpy = y;
                    mp3.Play("sound/inside2.wav");

                    break;
                }
                if (xxx <= 320)
                    xxx += 40;
                else
                    xxx = 0;
                label3.Text = Convert.ToInt32(x).ToString() + ":" + Convert.ToInt32(y).ToString();
            }

            DRAWIMAGEXX(gb, TakeScreenshot(0, 400, bmplayer2, 17, 17, 17, 17, 1.5), Convert.ToInt32(tmpx), Convert.ToInt32(tmpy), 1, 1);

            for (t = 7; t >= 6; t = t - 0.2)

            {
                sleeptime = 5;
                Thread t1 = new Thread(MyBackgroundTask2);
                t1.Start();
                t1.Join();
                double x = xx(2.5 * t, tmpx);
                double y = yy(0.2 * t, tmpy);

                if (t == 6)
                {
                    tmpx = x;
                    tmpy = y;
                }

            }



            DRAWIMAGEXX(gb, TakeScreenshot(0, 400, bmplayer2, 17, 17, 17, 17, 1.5), Convert.ToInt32(tmpx), Convert.ToInt32(tmpy), 1, 1);



            EnemyPB1.SendToBack();
            mp3.Play("sound/inside.wav");

            for (double i = 2; i >= 1; i -= 0.1)
            {

                sleeptime = 1;
                Thread t1 = new Thread(MyBackgroundTask2);
                t1.Start();
                t1.Join();
                DRAWIMAGEXX(gb, TakeScreenshot(0, 400, bmplayer2, 17, 17, 17, 17, 1.5), Convert.ToInt32(tmpx), Convert.ToInt32(tmpy), 0, 0);
                DRAWIMAGEXX(gb, TakeScreenshot(0, 0, bmplayer3, 1, 1, 1, 1, i), EnemyPB1.Location.X, EnemyPB1.Location.Y, 1, 1);

                if (EnemyPB1.Location.X >= pictureBox2.Location.X + 50)
                    EnemyPB1.Location = new Point(EnemyPB1.Location.X - 2, EnemyPB1.Location.Y - 1);
                else
                    EnemyPB1.Image = null;

            }

            DRAWIMAGEXX(gb, TakeScreenshot(0, 0, bmplayer2, 17, 17, 17, 17, 1.5), Convert.ToInt32(tmpx), Convert.ToInt32(tmpy), 1, 1);
            back.Play("sound/ballund.wav");

            for (t = 0; t < 5; t = t + 0.4)
            {


                double x = tmpx;
                double y = yy(1.5 * t, 0);
                if (y >= 200)
                {
                    tmpy = y;
                    break;
                }
                DRAWIMAGEXX(gb, TakeScreenshot(0, 0, bmplayer2, 17, 17, 17, 17, 1.5), Convert.ToInt32(tmpx), Convert.ToInt32(tmpy), 1, 1);
                tmpy = y;
            }

            for (t = 5; t >= 0; t = t - 0.2)
            {

                double x = tmpx;
                double y = yy(t, 0);
                if (y <= 100)
                {
                    tmpy = 100;
                    break;
                }
                DRAWIMAGEXX(gb, TakeScreenshot(0, 0, bmplayer2, 17, 17, 17, 17, 1.5), Convert.ToInt32(tmpx), Convert.ToInt32(tmpy), 1, 1);
                tmpy = y;
            }
            back.Play("sound/ballund.wav");
            for (t = 0; t < 5; t = t + 0.4)
            {
                double x = tmpx;
                double y = yy(1.5 * t, tmpy);
                if (y >= 200)
                {
                    break;
                }
                DRAWIMAGEXX(gb, TakeScreenshot(0, 0, bmplayer2, 17, 17, 17, 17, 1.5), Convert.ToInt32(tmpx), Convert.ToInt32(tmpy), 1, 1);
                tmpy = y;
            }

            int pok = 440;
            for (int j = 1; j <= 6; j++)
            {
                if (j % 2 == 0) pok = 440; else pok = 560;
                for (int i = 1; i <= 29; i += 2)
                {
                    label3.Text = i.ToString();
                    if (i == 1)
                        mp3.Play("sound/ball.wav");
                    sleeptime = 1;
                    Thread t1 = new Thread(MyBackgroundTask2);
                    t1.Start();
                    t1.Join();
                    bmplayer2 = new Bitmap("pok/ball.png");
                    DRAWIMAGEXX(gb, TakeScreenshot(0, pok, bmplayer2, 17, 17, 17, 17, 1.5), Convert.ToInt32(tmpx), Convert.ToInt32(tmpy), 1, 1);

                    if (i % 9 == 0)
                        pok += 40;
                }
                DRAWIMAGEXX(gb, TakeScreenshot(0, 0, bmplayer2, 17, 17, 17, 17, 1.5), Convert.ToInt32(tmpx), Convert.ToInt32(tmpy), 1, 1);


            }

            mp3.Play("sound/get.mp3");
            DRAWIMAGEXX(gb, TakeScreenshot(0, 0, bmplayer2, 17, 17, 17, 17, 1.5), Convert.ToInt32(tmpx), Convert.ToInt32(tmpy), 1, 1);
            EnemyPB1.Location = new Point(enytmpx, enytmpy);

            label4.Text = "抓到了!!";

            wmp2.URL = "sound/win2.mp3";
            wmp2.Ctlcontrols.play();
            if(pokarr[11]=="-1")
            get_pok();
            catcho = 1;
            stop();
            gb.Clear(Color.Transparent);
            catching = 0;
            radioButton1.Enabled = true;
            if (train == 1)
                radioButton2.Enabled = false;
            else
                radioButton2.Enabled = true;
            radioButton3.Enabled = true;
            radioButton4.Enabled = true;
        }
        public void DRAWIMAGEXX(Graphics gb, Bitmap image, double x, double y, int refresh, int clear)
        {
            gb.DrawImage(image, Convert.ToInt32(x), Convert.ToInt32(y)); // 先绘制背景层
            if (refresh == 1)
                pictureBox2.Refresh();
            if (clear == 1)
                gb.Clear(Color.Transparent);
            GC.Collect();

        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {
            back.Play("sound/menu.wav");
        }
        void stop()
        {
            enemyAttackTimer.Enabled = false;
            Playerattacttimer.Enabled = false;

        }
        void start()
        {
            enemyAttackTimer.Enabled = true;
            Playerattacttimer.Enabled = true;

        }




        private double xx(double t, double basex)
        {
            double v0 = 30;//水平初速度
            return (v0 * t) + basex;
        }

        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {
            back.Play("sound/menu.wav");
        }

        private void radioButton3_CheckedChanged(object sender, EventArgs e)
        {
            back.Play("sound/menu.wav");
        }

        private void radioButton4_CheckedChanged(object sender, EventArgs e)
        {

            if (catcho == 1 || win == 1 || outside == 1 || over == 1)
            {

                over = 1; this.Close();

            }
            back.Play("sound/menu.wav");
        }

        private void timer7_Tick(object sender, EventArgs e)
        {

            sh1 += 1;
            if (EnemyPB1.Visible == true)
                EnemyPB1.Visible = false;
            else
                EnemyPB1.Visible = true;
            if (sh1 >= 4)
            {
                EnemyPB1.Visible = true;
                timer7.Enabled = false;
                locked = 0;
                sh1 = 0;
            }
        }

        private void timer8_Tick(object sender, EventArgs e)
        {
            sh2 += 1;
            if (PartyPB1.Visible == true)
                PartyPB1.Visible = false;
            else
                PartyPB1.Visible = true;

            if (sh2 >= 4)
            {
                PartyPB1.Visible = true;
                timer8.Enabled = false;

                sh2 = 0;


            }
        }



        private void button3_Click(object sender, EventArgs e)
        {
            pictureBox5.Size = new Size(pictureBox5.Size.Width + 5, pictureBox5.Size.Height);
        }
        public void attack(int basic, int sum, int change)
        {
            plattack = basic * sum;
            plattack_now = pictureBox5.Size.Width - plattack;
            if (change == 1)
                timer9.Enabled = true;
            timer9.Enabled = true;
        }
        public void attack2(int basic, int sum)
        {
            enattack = basic * sum;
            enattack_now = pictureBox7.Size.Width - enattack;
            timer10.Enabled = true;
        }
        void enyattack()
        {
            Random crandom = new Random(Guid.NewGuid().GetHashCode());
            int crit = crandom.Next(1, 10);

            if (crit < 2)
            {
                wmp3.URL = "sound/lit.wav";
                label4.Text = "enermy Attack!!";
            }
            if (crit > 2 && crit < 9)
            {
                wmp3.URL = "sound/knf.wav";
                label4.Text = "enermy Attack!!";


            }
            if (crit >= 9)
            {

                label4.Text = "enermy Attack!!";

                wmp3.URL = "sound/cr.wav";


            }

            wmp3.Ctlcontrols.play();

            attack2(plhp, crit);
            timer8.Enabled = true;


        }
        private void timer9_Tick(object sender, EventArgs e)
        {
            radioButton1.Enabled = false;
            radioButton2.Enabled = false;
            radioButton3.Enabled = false;
            radioButton4.Enabled = false;

            this.Refresh();
            if ((pictureBox5.Size.Width) <= 150 && (pictureBox5.Size.Width) >= 50)
                pictureBox5.BackColor = Color.Orange;
            else if ((pictureBox5.Size.Width) < 50)
                pictureBox5.BackColor = Color.Red;

            if ((pictureBox5.Size.Width - 1) != plattack_now)
                pictureBox5.Size = new Size(pictureBox5.Size.Width - 1, pictureBox5.Size.Height);
            else
            {

                start();
                plattack = 0;
                plattack_now = 0;
                timer9.Enabled = false;
                enyattack();


            }
            if (pictureBox5.Size.Width <= 0)
            {
                label4.Text = "Youw Win!!";
                win = 1;
                wmp2.URL = "sound/win.mp3";
                wmp2.Ctlcontrols.play();
                timer9.Enabled = false;
                wmp5.Ctlcontrols.stop();
                timer3.Enabled = false;
                timer4.Enabled = false;
                timer5.Enabled = false;
                timer6.Enabled = false;
                radioButton1.Enabled = true;
                if (train == 1)
                    radioButton2.Enabled = false;
                else
                    radioButton2.Enabled = true;
                radioButton3.Enabled = true;
                radioButton4.Enabled = true;
                stop();
            }

        }

        private void timer10_Tick(object sender, EventArgs e)
        {
            radioButton1.Enabled = false;
            radioButton2.Enabled = false;
            radioButton3.Enabled = false;
            radioButton4.Enabled = false;

            this.Refresh();
            if ((pictureBox7.Size.Width) > 150)
            {
                wmp2.Ctlcontrols.play();

                wmp5.Ctlcontrols.pause();

                pictureBox7.BackColor = Color.MediumSeaGreen;
            }
            else if ((pictureBox7.Size.Width) <= 150 && (pictureBox7.Size.Width) >= 50)
            {
                wmp2.Ctlcontrols.play();

                wmp5.Ctlcontrols.pause();

                pictureBox7.BackColor = Color.Orange;
            }
            else if ((pictureBox7.Size.Width) < 50)
            {

                wmp2.Ctlcontrols.pause();
                if (wmp5.URL != "sound/lowhp.mp3")

                    wmp5.URL = "sound/lowhp.mp3";
                wmp5.Ctlcontrols.play();

                pictureBox7.BackColor = Color.Red;

            }

            if ((pictureBox7.Size.Width - 1) != enattack_now)
                pictureBox7.Size = new Size(pictureBox7.Size.Width - 1, pictureBox7.Size.Height);
            else
            {
                label4.Text = "what to do now?";
                radioButton1.Enabled = true;
                if (train == 1)
                    radioButton2.Enabled = false;
                else
                    radioButton2.Enabled = true;
                radioButton3.Enabled = true;
                radioButton4.Enabled = true;



                stop();

                start();
                enattack = 0;
                enattack_now = 0;
                timer10.Enabled = false;
                radioButton5.Checked =false;
            }
            if (pictureBox7.Size.Width <= 0)
            {
                pictureBox1.BringToFront();
                pictureBox1.ImageLocation = "pok/gameover.png";
                enemyAttackTimer.Enabled = false;

                wmp2.Ctlcontrols.stop();
                pictureBox1.Visible = true;
                wmp.Ctlcontrols.stop();
                wmp2.Ctlcontrols.stop();
                wmp.URL = "sound/gameover.mid";
                wmp.Ctlcontrols.play();
                Thread t1 = new Thread(MyBackgroundTask);
                t1.Start();

                timer10.Enabled = false;
                wmp5.Ctlcontrols.stop();
                stop();
            }




        }

        private void radioButton5_CheckedChanged(object sender, EventArgs e)
        {

            back.Play("sound/menu.wav");
            locked = 1;
        }

        private void radioButton6_CheckedChanged(object sender, EventArgs e)
        {


            back.Play("sound/menu.wav");
            locked = 1;
        }

        private void radioButton7_CheckedChanged(object sender, EventArgs e)
        {

            back.Play("sound/menu.wav");
            locked = 1;
        }

        private void radioButton8_CheckedChanged(object sender, EventArgs e)
        {


            back.Play("sound/menu.wav");
            locked = 1;
        }

        private void timer3_Tick(object sender, EventArgs e)
        {


            Poison--;
            pictureBox11.BackColor = Color.Purple;
            attack(enhp, 1, 0);
            if (Poison <= 0)
            {
                pictureBox11.BackColor = Color.White;
                timer3.Enabled = false;
                Poison = 3;
            }
        }

        private void wmp_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
        {
            if (e.newState == 1)
                this.wmp.Ctlcontrols.play();
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {

        }

        private void timer1_Tick(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {

        }

        private double yy(double t, double basey)
        {
            double g = 9.8;//重力加速度
            return (0.5 * g * t * t) + basey;
        }

        int pok_length;
        string all_pok;
        int item;
        string[] pokarr = new string[12];
        private void check_pok()
        {
            StreamReader sr = new StreamReader(@"pok.txt");
            string a;
            //===逐行讀取,直到檔尾===
            item = 0;
            while (!sr.EndOfStream)
            {
                a = sr.ReadLine();
                string[] strArray = a.Split(',');
                for (int i = 0; i < strArray.Length; i++)        //透過迴圈將陣列值取出 也可用foreach
                {
                    pokarr[item] = strArray[i].ToString();
                    item++;
                }

                pok_length = strArray.Length;
            }

            sr.Close();

        }
        private void get_pok()
        {
            for (int i= 0; i <14; i++)
            {
                if (pokarr[i] == "-1")
                {
                    item = i;
                    break;
                }

            }
            pokarr[item] = now_monname;
            pokarr[item+1] = "1000";
            for (int i = 0; i < 12; i++)
            {
                all_pok += pokarr[i];
                if ((i + 1) % 2 == 0)
                {
                    all_pok += "\r\n";
                }
                else
                    all_pok += ",";
            }

            StreamWriter sw = new StreamWriter(@"pok.txt", false);
            //第二個參數設定為true表示不覆蓋原本的內容,把新內容直接添加進去
            sw.Write(all_pok);
            sw.Flush();
            sw.Close();
            all_pok = null;

        }
    }
    /*
        public static class ModifyProgressBarColor
        {
            [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
            static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr w, IntPtr l);
            public static void SetState(this ProgressBar pBar, int state)
            {
                SendMessage(pBar.Handle, 1040, (IntPtr)state, IntPtr.Zero);
            }
        }*/

}

Form1.Designer.cs

csharp
namespace WindowsFormsApplication1
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
            this.label1 = new System.Windows.Forms.Label();
            this.wmp = new AxWMPLib.AxWindowsMediaPlayer();
            this.label2 = new System.Windows.Forms.Label();
            this.timer2 = new System.Windows.Forms.Timer(this.components);
            this.timer3 = new System.Windows.Forms.Timer(this.components);
            this.label9 = new System.Windows.Forms.Label();
            this.back = new AxWMPLib.AxWindowsMediaPlayer();
            this.back2 = new AxWMPLib.AxWindowsMediaPlayer();
            this.label3 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.item0 = new System.Windows.Forms.Label();
            this.item1 = new System.Windows.Forms.Label();
            this.item2 = new System.Windows.Forms.Label();
            this.item5 = new System.Windows.Forms.Label();
            this.item4 = new System.Windows.Forms.Label();
            this.item3 = new System.Windows.Forms.Label();
            this.item8 = new System.Windows.Forms.Label();
            this.item7 = new System.Windows.Forms.Label();
            this.item6 = new System.Windows.Forms.Label();
            this.item11 = new System.Windows.Forms.Label();
            this.item10 = new System.Windows.Forms.Label();
            this.item9 = new System.Windows.Forms.Label();
            this.item12 = new System.Windows.Forms.Label();
            this.back3 = new AxWMPLib.AxWindowsMediaPlayer();
            this.label5 = new System.Windows.Forms.Label();
            this.pictureBox4 = new System.Windows.Forms.PictureBox();
            this.pictureBox3 = new System.Windows.Forms.PictureBox();
            this.pictureBox2 = new System.Windows.Forms.PictureBox();
            this.pictureBox1 = new System.Windows.Forms.PictureBox();
            this.itemx = new System.Windows.Forms.PictureBox();
            this.timer1 = new System.Windows.Forms.Timer(this.components);
            this.timer4 = new System.Windows.Forms.Timer(this.components);
            this.timer5 = new System.Windows.Forms.Timer(this.components);
            this.label6 = new System.Windows.Forms.Label();
            this.pictureBox5 = new System.Windows.Forms.PictureBox();
            this.pictureBox6 = new System.Windows.Forms.PictureBox();
            this.label7 = new System.Windows.Forms.Label();
            this.pictureBox7 = new System.Windows.Forms.PictureBox();
            this.label8 = new System.Windows.Forms.Label();
            this.pictureBox8 = new System.Windows.Forms.PictureBox();
            this.label10 = new System.Windows.Forms.Label();
            this.pictureBox9 = new System.Windows.Forms.PictureBox();
            this.label11 = new System.Windows.Forms.Label();
            this.pictureBox10 = new System.Windows.Forms.PictureBox();
            this.label12 = new System.Windows.Forms.Label();
            ((System.ComponentModel.ISupportInitialize)(this.wmp)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.back)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.back2)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.back3)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.itemx)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox8)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox9)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox10)).BeginInit();
            this.SuspendLayout();
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.BackColor = System.Drawing.Color.Transparent;
            this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label1.Location = new System.Drawing.Point(1043, 281);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(47, 16);
            this.label1.TabIndex = 1;
            this.label1.Text = "FUCK";
            // 
            // wmp
            // 
            this.wmp.Enabled = true;
            this.wmp.Location = new System.Drawing.Point(954, 370);
            this.wmp.Name = "wmp";
            this.wmp.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("wmp.OcxState")));
            this.wmp.Size = new System.Drawing.Size(75, 23);
            this.wmp.TabIndex = 2;
            this.wmp.Visible = false;
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.BackColor = System.Drawing.SystemColors.ButtonHighlight;
            this.label2.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
            this.label2.Location = new System.Drawing.Point(500, 389);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(35, 13);
            this.label2.TabIndex = 3;
            this.label2.Text = "label2";
            this.label2.Visible = false;
            // 
            // timer2
            // 
            this.timer2.Enabled = true;
            this.timer2.Interval = 1;
            this.timer2.Tick += new System.EventHandler(this.timer2_Tick);
            // 
            // timer3
            // 
            this.timer3.Enabled = true;
            this.timer3.Tick += new System.EventHandler(this.timer3_Tick);
            // 
            // label9
            // 
            this.label9.BackColor = System.Drawing.Color.White;
            this.label9.Font = new System.Drawing.Font("WenQuanYi Micro Hei", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.label9.Location = new System.Drawing.Point(12, 510);
            this.label9.Name = "label9";
            this.label9.Size = new System.Drawing.Size(639, 132);
            this.label9.TabIndex = 14;
            this.label9.Text = "label9";
            this.label9.Visible = false;
            // 
            // back
            // 
            this.back.Enabled = true;
            this.back.Location = new System.Drawing.Point(907, 414);
            this.back.Name = "back";
            this.back.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("back.OcxState")));
            this.back.Size = new System.Drawing.Size(75, 23);
            this.back.TabIndex = 15;
            this.back.Visible = false;
            // 
            // back2
            // 
            this.back2.Enabled = true;
            this.back2.Location = new System.Drawing.Point(698, 455);
            this.back2.Name = "back2";
            this.back2.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("back2.OcxState")));
            this.back2.Size = new System.Drawing.Size(284, 23);
            this.back2.TabIndex = 16;
            this.back2.Visible = false;
            this.back2.StatusChange += new System.EventHandler(this.back2_StatusChange);
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.BackColor = System.Drawing.Color.WhiteSmoke;
            this.label3.Font = new System.Drawing.Font("Stencil", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label3.Location = new System.Drawing.Point(541, 34);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(85, 42);
            this.label3.TabIndex = 19;
            this.label3.Text = "BAG";
            this.label3.Visible = false;
            // 
            // label4
            // 
            this.label4.AutoSize = true;
            this.label4.BackColor = System.Drawing.Color.WhiteSmoke;
            this.label4.Font = new System.Drawing.Font("Stencil", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label4.Location = new System.Drawing.Point(542, 90);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(109, 42);
            this.label4.TabIndex = 20;
            this.label4.Text = "POKE";
            this.label4.Visible = false;
            // 
            // item0
            // 
            this.item0.AutoSize = true;
            this.item0.BackColor = System.Drawing.Color.WhiteSmoke;
            this.item0.Font = new System.Drawing.Font("WenQuanYi Micro Hei", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.item0.Location = new System.Drawing.Point(54, 132);
            this.item0.Name = "item0";
            this.item0.Size = new System.Drawing.Size(41, 31);
            this.item0.TabIndex = 22;
            this.item0.Text = "---";
            this.item0.Visible = false;
            // 
            // item1
            // 
            this.item1.AutoSize = true;
            this.item1.BackColor = System.Drawing.Color.WhiteSmoke;
            this.item1.Font = new System.Drawing.Font("WenQuanYi Micro Hei", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.item1.Location = new System.Drawing.Point(195, 132);
            this.item1.Name = "item1";
            this.item1.Size = new System.Drawing.Size(41, 31);
            this.item1.TabIndex = 23;
            this.item1.Text = "---";
            this.item1.Visible = false;
            // 
            // item2
            // 
            this.item2.AutoSize = true;
            this.item2.BackColor = System.Drawing.Color.WhiteSmoke;
            this.item2.Font = new System.Drawing.Font("WenQuanYi Micro Hei", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.item2.Location = new System.Drawing.Point(336, 132);
            this.item2.Name = "item2";
            this.item2.Size = new System.Drawing.Size(41, 31);
            this.item2.TabIndex = 24;
            this.item2.Text = "---";
            this.item2.Visible = false;
            // 
            // item5
            // 
            this.item5.AutoSize = true;
            this.item5.BackColor = System.Drawing.Color.WhiteSmoke;
            this.item5.Font = new System.Drawing.Font("WenQuanYi Micro Hei", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.item5.Location = new System.Drawing.Point(336, 225);
            this.item5.Name = "item5";
            this.item5.Size = new System.Drawing.Size(41, 31);
            this.item5.TabIndex = 27;
            this.item5.Text = "---";
            this.item5.Visible = false;
            // 
            // item4
            // 
            this.item4.AutoSize = true;
            this.item4.BackColor = System.Drawing.Color.WhiteSmoke;
            this.item4.Font = new System.Drawing.Font("WenQuanYi Micro Hei", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.item4.Location = new System.Drawing.Point(195, 225);
            this.item4.Name = "item4";
            this.item4.Size = new System.Drawing.Size(41, 31);
            this.item4.TabIndex = 26;
            this.item4.Text = "---";
            this.item4.Visible = false;
            // 
            // item3
            // 
            this.item3.AutoSize = true;
            this.item3.BackColor = System.Drawing.Color.WhiteSmoke;
            this.item3.Font = new System.Drawing.Font("WenQuanYi Micro Hei", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.item3.Location = new System.Drawing.Point(54, 225);
            this.item3.Name = "item3";
            this.item3.Size = new System.Drawing.Size(41, 31);
            this.item3.TabIndex = 25;
            this.item3.Text = "---";
            this.item3.Visible = false;
            // 
            // item8
            // 
            this.item8.AutoSize = true;
            this.item8.BackColor = System.Drawing.Color.WhiteSmoke;
            this.item8.Font = new System.Drawing.Font("WenQuanYi Micro Hei", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.item8.Location = new System.Drawing.Point(336, 318);
            this.item8.Name = "item8";
            this.item8.Size = new System.Drawing.Size(41, 31);
            this.item8.TabIndex = 30;
            this.item8.Text = "---";
            this.item8.Visible = false;
            // 
            // item7
            // 
            this.item7.AutoSize = true;
            this.item7.BackColor = System.Drawing.Color.WhiteSmoke;
            this.item7.Font = new System.Drawing.Font("WenQuanYi Micro Hei", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.item7.Location = new System.Drawing.Point(195, 318);
            this.item7.Name = "item7";
            this.item7.Size = new System.Drawing.Size(41, 31);
            this.item7.TabIndex = 29;
            this.item7.Text = "---";
            this.item7.Visible = false;
            // 
            // item6
            // 
            this.item6.AutoSize = true;
            this.item6.BackColor = System.Drawing.Color.WhiteSmoke;
            this.item6.Font = new System.Drawing.Font("WenQuanYi Micro Hei", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.item6.Location = new System.Drawing.Point(54, 318);
            this.item6.Name = "item6";
            this.item6.Size = new System.Drawing.Size(41, 31);
            this.item6.TabIndex = 28;
            this.item6.Text = "---";
            this.item6.Visible = false;
            // 
            // item11
            // 
            this.item11.AutoSize = true;
            this.item11.BackColor = System.Drawing.Color.WhiteSmoke;
            this.item11.Font = new System.Drawing.Font("WenQuanYi Micro Hei", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.item11.Location = new System.Drawing.Point(336, 411);
            this.item11.Name = "item11";
            this.item11.Size = new System.Drawing.Size(41, 31);
            this.item11.TabIndex = 33;
            this.item11.Text = "---";
            this.item11.Visible = false;
            // 
            // item10
            // 
            this.item10.AutoSize = true;
            this.item10.BackColor = System.Drawing.Color.WhiteSmoke;
            this.item10.Font = new System.Drawing.Font("WenQuanYi Micro Hei", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.item10.Location = new System.Drawing.Point(195, 411);
            this.item10.Name = "item10";
            this.item10.Size = new System.Drawing.Size(41, 31);
            this.item10.TabIndex = 32;
            this.item10.Text = "---";
            this.item10.Visible = false;
            // 
            // item9
            // 
            this.item9.AutoSize = true;
            this.item9.BackColor = System.Drawing.Color.WhiteSmoke;
            this.item9.Font = new System.Drawing.Font("WenQuanYi Micro Hei", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.item9.Location = new System.Drawing.Point(54, 411);
            this.item9.Name = "item9";
            this.item9.Size = new System.Drawing.Size(41, 31);
            this.item9.TabIndex = 31;
            this.item9.Text = "---";
            this.item9.Visible = false;
            // 
            // item12
            // 
            this.item12.AutoSize = true;
            this.item12.BackColor = System.Drawing.Color.WhiteSmoke;
            this.item12.Font = new System.Drawing.Font("WenQuanYi Micro Hei", 24F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.item12.Location = new System.Drawing.Point(40, 43);
            this.item12.Name = "item12";
            this.item12.Size = new System.Drawing.Size(47, 38);
            this.item12.TabIndex = 34;
            this.item12.Text = "---";
            this.item12.Visible = false;
            // 
            // back3
            // 
            this.back3.Enabled = true;
            this.back3.Location = new System.Drawing.Point(698, 484);
            this.back3.Name = "back3";
            this.back3.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("back3.OcxState")));
            this.back3.Size = new System.Drawing.Size(284, 23);
            this.back3.TabIndex = 35;
            this.back3.Visible = false;
            // 
            // label5
            // 
            this.label5.AutoSize = true;
            this.label5.BackColor = System.Drawing.Color.WhiteSmoke;
            this.label5.Font = new System.Drawing.Font("Stencil", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label5.Location = new System.Drawing.Point(517, 284);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(38, 16);
            this.label5.TabIndex = 36;
            this.label5.Text = "MAP:";
            this.label5.Visible = false;
            // 
            // pictureBox4
            // 
            this.pictureBox4.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox4.Image")));
            this.pictureBox4.Location = new System.Drawing.Point(517, 43);
            this.pictureBox4.Name = "pictureBox4";
            this.pictureBox4.Size = new System.Drawing.Size(18, 24);
            this.pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.pictureBox4.TabIndex = 18;
            this.pictureBox4.TabStop = false;
            this.pictureBox4.Visible = false;
            this.pictureBox4.Move += new System.EventHandler(this.pictureBox4_Move);
            // 
            // pictureBox3
            // 
            this.pictureBox3.Image = global::pokemon.Properties.Resources.menu2;
            this.pictureBox3.Location = new System.Drawing.Point(496, 12);
            this.pictureBox3.Name = "pictureBox3";
            this.pictureBox3.Size = new System.Drawing.Size(177, 374);
            this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.pictureBox3.TabIndex = 17;
            this.pictureBox3.TabStop = false;
            this.pictureBox3.Visible = false;
            this.pictureBox3.VisibleChanged += new System.EventHandler(this.pictureBox3_VisibleChanged);
            // 
            // pictureBox2
            // 
            this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image")));
            this.pictureBox2.Location = new System.Drawing.Point(-3, 501);
            this.pictureBox2.Name = "pictureBox2";
            this.pictureBox2.Size = new System.Drawing.Size(692, 159);
            this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.pictureBox2.TabIndex = 13;
            this.pictureBox2.TabStop = false;
            this.pictureBox2.Visible = false;
            this.pictureBox2.VisibleChanged += new System.EventHandler(this.pictureBox2_VisibleChanged);
            // 
            // pictureBox1
            // 
            this.pictureBox1.Location = new System.Drawing.Point(874, 34);
            this.pictureBox1.Name = "pictureBox1";
            this.pictureBox1.Size = new System.Drawing.Size(274, 280);
            this.pictureBox1.TabIndex = 0;
            this.pictureBox1.TabStop = false;
            this.pictureBox1.Visible = false;
            this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
            // 
            // itemx
            // 
            this.itemx.Image = global::pokemon.Properties.Resources.menu;
            this.itemx.Location = new System.Drawing.Point(12, 12);
            this.itemx.Name = "itemx";
            this.itemx.Size = new System.Drawing.Size(465, 466);
            this.itemx.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.itemx.TabIndex = 21;
            this.itemx.TabStop = false;
            this.itemx.Visible = false;
            this.itemx.VisibleChanged += new System.EventHandler(this.pictureBox5_VisibleChanged);
            // 
            // timer1
            // 
            this.timer1.Enabled = true;
            this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
            // 
            // timer4
            // 
            this.timer4.Tick += new System.EventHandler(this.timer4_Tick);
            // 
            // timer5
            // 
            this.timer5.Tick += new System.EventHandler(this.timer5_Tick);
            // 
            // label6
            // 
            this.label6.AutoSize = true;
            this.label6.BackColor = System.Drawing.SystemColors.ButtonHighlight;
            this.label6.Font = new System.Drawing.Font("Miramonte", 48F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label6.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
            this.label6.Location = new System.Drawing.Point(80, 519);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(534, 78);
            this.label6.TabIndex = 38;
            this.label6.Text = "PUSH Z BUTTON";
            // 
            // pictureBox5
            // 
            this.pictureBox5.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox5.Image")));
            this.pictureBox5.Location = new System.Drawing.Point(0, 0);
            this.pictureBox5.Name = "pictureBox5";
            this.pictureBox5.Size = new System.Drawing.Size(685, 660);
            this.pictureBox5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.pictureBox5.TabIndex = 39;
            this.pictureBox5.TabStop = false;
            this.pictureBox5.Visible = false;
            this.pictureBox5.VisibleChanged += new System.EventHandler(this.pictureBox5_VisibleChanged_1);
            this.pictureBox5.Paint += new System.Windows.Forms.PaintEventHandler(this.pictureBox5_Paint);
            // 
            // pictureBox6
            // 
            this.pictureBox6.BackColor = System.Drawing.Color.Teal;
            this.pictureBox6.Image = global::pokemon.Properties.Resources._1231;
            this.pictureBox6.Location = new System.Drawing.Point(212, 43);
            this.pictureBox6.Name = "pictureBox6";
            this.pictureBox6.Size = new System.Drawing.Size(450, 72);
            this.pictureBox6.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.pictureBox6.TabIndex = 40;
            this.pictureBox6.TabStop = false;
            this.pictureBox6.Visible = false;
            this.pictureBox6.Paint += new System.Windows.Forms.PaintEventHandler(this.pictureBox6_Paint);
            // 
            // label7
            // 
            this.label7.AutoSize = true;
            this.label7.BackColor = System.Drawing.Color.LightSkyBlue;
            this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label7.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
            this.label7.Location = new System.Drawing.Point(512, 86);
            this.label7.Name = "label7";
            this.label7.Size = new System.Drawing.Size(22, 29);
            this.label7.TabIndex = 41;
            this.label7.Text = "-";
            this.label7.Visible = false;
            // 
            // pictureBox7
            // 
            this.pictureBox7.BackColor = System.Drawing.Color.Teal;
            this.pictureBox7.Image = global::pokemon.Properties.Resources._1231;
            this.pictureBox7.Location = new System.Drawing.Point(212, 159);
            this.pictureBox7.Name = "pictureBox7";
            this.pictureBox7.Size = new System.Drawing.Size(450, 72);
            this.pictureBox7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.pictureBox7.TabIndex = 42;
            this.pictureBox7.TabStop = false;
            this.pictureBox7.Visible = false;
            this.pictureBox7.Paint += new System.Windows.Forms.PaintEventHandler(this.pictureBox7_Paint);
            // 
            // label8
            // 
            this.label8.AutoSize = true;
            this.label8.BackColor = System.Drawing.Color.LightSkyBlue;
            this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label8.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
            this.label8.Location = new System.Drawing.Point(512, 208);
            this.label8.Name = "label8";
            this.label8.Size = new System.Drawing.Size(22, 29);
            this.label8.TabIndex = 43;
            this.label8.Text = "-";
            this.label8.Visible = false;
            // 
            // pictureBox8
            // 
            this.pictureBox8.BackColor = System.Drawing.Color.Teal;
            this.pictureBox8.Image = global::pokemon.Properties.Resources._1231;
            this.pictureBox8.Location = new System.Drawing.Point(212, 275);
            this.pictureBox8.Name = "pictureBox8";
            this.pictureBox8.Size = new System.Drawing.Size(450, 72);
            this.pictureBox8.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.pictureBox8.TabIndex = 44;
            this.pictureBox8.TabStop = false;
            this.pictureBox8.Visible = false;
            this.pictureBox8.Paint += new System.Windows.Forms.PaintEventHandler(this.pictureBox8_Paint);
            // 
            // label10
            // 
            this.label10.AutoSize = true;
            this.label10.BackColor = System.Drawing.Color.LightSkyBlue;
            this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label10.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
            this.label10.Location = new System.Drawing.Point(512, 326);
            this.label10.Name = "label10";
            this.label10.Size = new System.Drawing.Size(22, 29);
            this.label10.TabIndex = 45;
            this.label10.Text = "-";
            this.label10.Visible = false;
            // 
            // pictureBox9
            // 
            this.pictureBox9.BackColor = System.Drawing.Color.Teal;
            this.pictureBox9.Image = global::pokemon.Properties.Resources._1231;
            this.pictureBox9.Location = new System.Drawing.Point(212, 391);
            this.pictureBox9.Name = "pictureBox9";
            this.pictureBox9.Size = new System.Drawing.Size(450, 72);
            this.pictureBox9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.pictureBox9.TabIndex = 46;
            this.pictureBox9.TabStop = false;
            this.pictureBox9.Visible = false;
            this.pictureBox9.Paint += new System.Windows.Forms.PaintEventHandler(this.pictureBox9_Paint);
            // 
            // label11
            // 
            this.label11.AutoSize = true;
            this.label11.BackColor = System.Drawing.Color.LightSkyBlue;
            this.label11.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label11.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
            this.label11.Location = new System.Drawing.Point(512, 447);
            this.label11.Name = "label11";
            this.label11.Size = new System.Drawing.Size(22, 29);
            this.label11.TabIndex = 47;
            this.label11.Text = "-";
            this.label11.Visible = false;
            // 
            // pictureBox10
            // 
            this.pictureBox10.BackColor = System.Drawing.Color.Teal;
            this.pictureBox10.Image = global::pokemon.Properties.Resources._1231;
            this.pictureBox10.Location = new System.Drawing.Point(212, 507);
            this.pictureBox10.Name = "pictureBox10";
            this.pictureBox10.Size = new System.Drawing.Size(450, 72);
            this.pictureBox10.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.pictureBox10.TabIndex = 48;
            this.pictureBox10.TabStop = false;
            this.pictureBox10.Visible = false;
            this.pictureBox10.Paint += new System.Windows.Forms.PaintEventHandler(this.pictureBox10_Paint);
            // 
            // label12
            // 
            this.label12.AutoSize = true;
            this.label12.BackColor = System.Drawing.Color.LightSkyBlue;
            this.label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label12.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
            this.label12.Location = new System.Drawing.Point(512, 562);
            this.label12.Name = "label12";
            this.label12.Size = new System.Drawing.Size(22, 29);
            this.label12.TabIndex = 49;
            this.label12.Text = "-";
            this.label12.Visible = false;
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.BackColor = System.Drawing.SystemColors.ButtonFace;
            this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
            this.ClientSize = new System.Drawing.Size(684, 661);
            this.Controls.Add(this.label10);
            this.Controls.Add(this.label7);
            this.Controls.Add(this.pictureBox6);
            this.Controls.Add(this.label8);
            this.Controls.Add(this.label12);
            this.Controls.Add(this.pictureBox10);
            this.Controls.Add(this.label11);
            this.Controls.Add(this.pictureBox9);
            this.Controls.Add(this.pictureBox8);
            this.Controls.Add(this.pictureBox7);
            this.Controls.Add(this.pictureBox5);
            this.Controls.Add(this.label6);
            this.Controls.Add(this.item12);
            this.Controls.Add(this.item11);
            this.Controls.Add(this.item10);
            this.Controls.Add(this.item9);
            this.Controls.Add(this.item8);
            this.Controls.Add(this.item7);
            this.Controls.Add(this.item6);
            this.Controls.Add(this.item5);
            this.Controls.Add(this.item4);
            this.Controls.Add(this.item3);
            this.Controls.Add(this.item2);
            this.Controls.Add(this.item1);
            this.Controls.Add(this.item0);
            this.Controls.Add(this.label5);
            this.Controls.Add(this.back3);
            this.Controls.Add(this.pictureBox4);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.pictureBox3);
            this.Controls.Add(this.back2);
            this.Controls.Add(this.back);
            this.Controls.Add(this.label9);
            this.Controls.Add(this.pictureBox2);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.wmp);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.pictureBox1);
            this.Controls.Add(this.itemx);
            this.Name = "Form1";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "Pokemon";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown);
            this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyUp);
            ((System.ComponentModel.ISupportInitialize)(this.wmp)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.back)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.back2)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.back3)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.itemx)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox8)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox9)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox10)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.PictureBox pictureBox1;
        private System.Windows.Forms.Label label1;
        private AxWMPLib.AxWindowsMediaPlayer wmp;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Timer timer2;
        private System.Windows.Forms.Timer timer3;
        private System.Windows.Forms.PictureBox pictureBox2;
        private System.Windows.Forms.Label label9;
        private AxWMPLib.AxWindowsMediaPlayer back;
        private AxWMPLib.AxWindowsMediaPlayer back2;
        private System.Windows.Forms.PictureBox pictureBox3;
        private System.Windows.Forms.PictureBox pictureBox4;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.PictureBox itemx;
        private System.Windows.Forms.Label item0;
        private System.Windows.Forms.Label item1;
        private System.Windows.Forms.Label item2;
        private System.Windows.Forms.Label item5;
        private System.Windows.Forms.Label item4;
        private System.Windows.Forms.Label item3;
        private System.Windows.Forms.Label item8;
        private System.Windows.Forms.Label item7;
        private System.Windows.Forms.Label item6;
        private System.Windows.Forms.Label item11;
        private System.Windows.Forms.Label item10;
        private System.Windows.Forms.Label item9;
        private System.Windows.Forms.Label item12;
        private AxWMPLib.AxWindowsMediaPlayer back3;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.Timer timer1;
        private System.Windows.Forms.Timer timer4;
        private System.Windows.Forms.Timer timer5;
        private System.Windows.Forms.Label label6;
        private System.Windows.Forms.PictureBox pictureBox5;
        private System.Windows.Forms.PictureBox pictureBox6;
        private System.Windows.Forms.Label label7;
        private System.Windows.Forms.PictureBox pictureBox7;
        private System.Windows.Forms.Label label8;
        private System.Windows.Forms.PictureBox pictureBox8;
        private System.Windows.Forms.Label label10;
        private System.Windows.Forms.PictureBox pictureBox9;
        private System.Windows.Forms.Label label11;
        private System.Windows.Forms.PictureBox pictureBox10;
        private System.Windows.Forms.Label label12;
    }
}

Form1.cs

csharp
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
//using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Gma.UserActivityMonitor;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        int start = 0;
        int start2 = 0;
        int item = 0;
        int env2 = 0;
        int env = 0;
        int enving = 0;
        int map1girl = 0;
        int map2boy = 0;
        int min = 0;
        int menu;
        int menu2x;
        int menu2y;
        int talking = 0;
        string[] itemarr;
        public string[] pokarr;
        KeyEventArgs keyboardtmp;
        bool IsADown = false;
        [DllImport("user32.dll")]
        private static extern bool SetWindowPos(int hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
        [DllImport("user32.dll")]
        public static extern int GetSystemMetrics(int screensize);
        public const int SM_CXSCREEN = 0;
        public const int SM_CYSCREEN = 1;
        private static IntPtr HWND_TOP = IntPtr.Zero;
        private const int SWP_SHOWWINDOW = 64;
        static Label[] labx = new Label[15];

        public Bitmap TakeScreenshot(int x, int y, Bitmap bmpx, int cutx1, int cutx2, int cuty1, int cuty2)
        {
            Bitmap destBitmap = new Bitmap(bmpx.Width, bmpx.Height);
            // destBitmap 為你的目的圖檔,長、寬為原圖1/3 
            Rectangle destRect = new Rectangle(0, 0, destBitmap.Width / cutx1, destBitmap.Height / cuty1); // 你的輸出範圍
            Rectangle srcRect = new Rectangle(x, y, bmpx.Width / cutx1, bmpx.Height / cuty2); // 你的原圖剪裁區域
            Graphics.FromImage(destBitmap).DrawImage(bmpx, destRect, srcRect, GraphicsUnit.Pixel);
            return destBitmap;
        }

        public Class1 game;
        public Form1()
        {

            InitializeComponent();

        }
        public void AlphaBlend(Bitmap source, byte alpha, Color backColor)
        {
            for (int x = 0; x < source.Width; x++)
            {
                for (int y = 0; y < source.Height; y++)
                {
                    Color sc = source.GetPixel(x, y);
                    byte R = (byte)(sc.R * alpha / 255 + backColor.R * (255 - alpha) / 255);
                    byte G = (byte)(sc.G * alpha / 255 + backColor.G * (255 - alpha) / 255);
                    byte B = (byte)(sc.B * alpha / 255 + backColor.B * (255 - alpha) / 255);
                    byte A = (byte)(sc.A * alpha / 255 + backColor.A * (255 - alpha) / 255);
                    source.SetPixel(x, y, Color.FromArgb(A, R, G, B));
                }
            }
        }

        Bitmap rainDrops;
        Timer timer = new Timer();
        byte xl = 255;


        private void Form1_Load(object sender, EventArgs e)
        {

            // timer.Interval = 1000;
            // timer.Enabled = true;
            // timer.Tick += delegate { Invalidate(); };
            labx[0] = item0;
            labx[1] = item1;
            labx[2] = item2;
            labx[3] = item3;
            labx[4] = item4;
            labx[5] = item5;
            labx[6] = item6;
            labx[7] = item7;
            labx[8] = item8;
            labx[9] = item9;
            labx[10] = item10;
            labx[11] = item11;
            labx[12] = item12;
            itemarr = new string[12];
            pokarr = new string[20];



            timer2.Enabled = true;
            // this.WindowState = FormWindowState.Normal;
            //  this.FormBorderStyle = FormBorderStyle.None;
            //  SetWindowPos((int)this.Handle, HWND_TOP, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), SWP_SHOWWINDOW);
            // this.ControlBox = true;
            timer2.Enabled = true;

        }
        private int checkface()
        {
            if (game.msy < game.ply)
                return 1;
            else if (game.msy > game.ply)
                return 2;
            else if (game.msx < game.plx)
                return 3;
            else if (game.msx > game.plx)
                return 4;
            else { return 0; }
        }
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {

            keyboardtmp = e;
            if (start == 0 && start2 == 0 && e.KeyCode == Keys.Z)
            {
                timer5.Enabled = true; back.URL = ("sound/menu.wav");
                back.Ctlcontrols.play();
            }
            if (start == 1)
            {
                if (enving == 0)
                {
                    game.handlekeypress(e);
                }

                //  if(e.KeyCode==Keys.Z)
                //    {
                if (e.KeyCode == Keys.X && talking == 0)
                {
                    label5.Text = "MAP:" + game.now_map;

                    if (pictureBox3.Visible == true)
                    {

                        enving = 0;
                        pictureBox3.Visible = false;
                        pictureBox4.Visible = false;


                        pictureBox6.Visible = false;
                        pictureBox7.Visible = false;
                        pictureBox8.Visible = false;
                        pictureBox9.Visible = false;
                        pictureBox10.Visible = false;

                        label7.Visible = false;
                        label8.Visible = false;
                        label10.Visible = false;
                        label11.Visible = false;
                        label12.Visible = false;

                        itemx.Visible = false;
                        label3.Visible = false;
                        label4.Visible = false;
                        label5.Visible = false;
                        pictureBox5.Visible = false;
                        for (int i = 0; i < 13; i++)
                            labx[i].Visible = false;

                        menu = 0;
                    }
                    else
                    {
                        menu2y = pictureBox6.Location.Y;
                        pictureBox4.Location = new Point(517, 43);
                        enving = 1;
                        pictureBox3.Visible = true;
                        pictureBox4.Visible = true;

                        label3.Visible = true;
                        label4.Visible = true;
                        label5.Visible = true;

                    }
                }
                if (e.KeyCode == Keys.Down && pictureBox3.Visible == true)
                {
                    if (menu == 2 && menu2y + 116 <= pictureBox10.Location.Y)
                        menu2y += 116;
                    if (menu == 0 && pictureBox4.Location.Y + 56 <= label4.Location.Y + 30)
                        pictureBox4.Location = new Point(pictureBox4.Location.X, pictureBox4.Location.Y + 56);
                    if (menu == 1 && pictureBox4.Location.Y + 93 <= labx[9].Location.Y + 30)
                        pictureBox4.Location = new Point(pictureBox4.Location.X, pictureBox4.Location.Y + 93);
                    for (int i = 0; i < 11; i++)
                    {
                        if (labx[i].Location.X == pictureBox4.Location.X + 20 && labx[i].Location.Y == pictureBox4.Location.Y - 5)
                        {
                            min = i;

                            check_item();
                        }
                    }



                }

                if (e.KeyCode == Keys.Up && pictureBox3.Visible == true)
                {
                    if (menu == 2 && menu2y - 116 >= pictureBox6.Location.Y)
                        menu2y -= 116;

                    if (menu == 0 && pictureBox4.Location.Y - 56 >= label3.Location.Y - 30)
                        pictureBox4.Location = new Point(pictureBox4.Location.X, pictureBox4.Location.Y - 56);
                    if (menu == 1 && pictureBox4.Location.Y - 93 >= labx[0].Location.Y - 30)
                        pictureBox4.Location = new Point(pictureBox4.Location.X, pictureBox4.Location.Y - 93);
                    for (int i = 0; i < 11; i++)
                    {
                        if (labx[i].Location.X == pictureBox4.Location.X + 20 && labx[i].Location.Y == pictureBox4.Location.Y - 5)
                        {
                            min = i;

                            check_item();
                        }
                    }


                }
                if (e.KeyCode == Keys.Left && itemx.Visible == true)
                {


                    if (menu == 1 && pictureBox4.Location.X - 141 >= labx[0].Location.X - 30)
                        pictureBox4.Location = new Point(pictureBox4.Location.X - 141, pictureBox4.Location.Y);
                    for (int i = 0; i < 11; i++)
                    {
                        if (labx[i].Location.X == pictureBox4.Location.X + 20 && labx[i].Location.Y == pictureBox4.Location.Y - 5)
                        {
                            min = i;

                            check_item();
                        }
                    }


                }
                if (e.KeyCode == Keys.Right && itemx.Visible == true)
                {


                    if (menu == 1 && pictureBox4.Location.X + 141 <= labx[2].Location.X + 30)

                        pictureBox4.Location = new Point(pictureBox4.Location.X + 141, pictureBox4.Location.Y);
                    for (int i = 0; i < 11; i++)
                    {
                        if (labx[i].Location.X == pictureBox4.Location.X + 20 && labx[i].Location.Y == pictureBox4.Location.Y - 5)
                        {
                            min = i;

                            check_item();
                        }
                    }


                }
                if (e.KeyCode == Keys.Z && pictureBox3.Visible == true && pictureBox4.Location.Y > label3.Location.Y && label3.Location.Y + label3.Size.Height > pictureBox4.Location.Y && menu == 0)
                {

                    talking = 0;
                    check_item();
                    menu = 1;
                    itemx.Visible = true;
                    for (int i = 0; i < 13; i++)
                        labx[i].Visible = true;
                    pictureBox4.Location = new Point(labx[0].Location.X - 20, labx[0].Location.Y + 5);

                }
                if (e.KeyCode == Keys.Z && pictureBox3.Visible == true && pictureBox4.Location.Y > label3.Location.Y && label4.Location.Y + label4.Size.Height > pictureBox4.Location.Y && menu == 0)
                {
                    check_pok();
                    menu2y = pictureBox6.Location.Y + Convert.ToInt32(pokarr[0]) * 116;
                    talking = 0;

                    menu = 2;

                    pictureBox5.Visible = true;

                    pictureBox6.Visible = true;
                    pictureBox7.Visible = true;
                    pictureBox8.Visible = true;
                    pictureBox9.Visible = true;
                    pictureBox10.Visible = true;
                    label7.Visible = true;
                    label8.Visible = true;
                    label10.Visible = true;
                    label11.Visible = true;
                    label12.Visible = true;
                }

                if (e.KeyCode == Keys.Z && pictureBox3.Visible == false)
                {

                    if (game.now_map == "Test2.txt" && game.max_monster[0] == 1)
                    {
                        talking = 1;
                        game.talkface(checkface(), 0);
                        talk(map2boy);
                        map2boy++;

                        if (map2boy == 3 && env2 == 0)
                        {
                            label9.Text = "統神哥哥:再來阿";
                            talk(map2boy);

                            if (game.max_monster[0] == 1)
                            {

                                back3.URL = ("再來阿.mp3");
                                back3.Ctlcontrols.play();

                                wmp.Ctlcontrols.stop();
                                game.shock();
                                game.View(true);
                                game.ms1();
                                env2 = 1;
                                map2boy = 0;
                                talk(map2boy);
                            }
                        }
                        else if (map2boy == 1 && env2 == 0)
                        {

                            label9.Text = "統神哥哥:想幹架嗎??";
                            talk(map2boy);
                            map2boy++;
                        }
                        else if (map2boy == 3 && env2 == 1)
                        {
                            label9.Text = "統神哥哥:外掛狗";

                            talk(map2boy);
                            map2boy++;
                        }
                        else if (map2boy == 1 && env2 == 1)
                        {

                            label9.Text = "統神哥哥:笑笑不多說";
                            talk(map2boy);
                            map2boy++;

                        }

                        else { map2boy = 0; }

                    }

                    /////////////////////////////////////////////////
                    if (game.now_map == "Test2.txt" && game.max_monster[1] == 1)
                    {
                        talking = 1;
                        game.talkface(checkface(), 1);
                        talk(map1girl);
                        map1girl++;
                        if (map1girl == 5)
                        {

                            label9.Text = "你失去了哈密瓜";
                            talk(map1girl);
                            map1girl++;
                            delate_item(1);
                        }
                        else if (map1girl == 3)
                        {

                            label9.Text = "統表:你他媽有被揍過?無差別偷你哈密瓜";
                            talk(map1girl);
                            map1girl++;

                        }
                        else if (map1girl == 1)
                        {

                            label9.Text = "統表:我哥哥在隔壁別來煩我,滾";
                            talk(map1girl);
                            map1girl++;

                        }

                        else { map1girl = 0; }

                    }

                    /////////////////////////////////////////////////
                    if (game.now_map == "Test.txt" && game.max_monster[1] == 1)
                    {
                        talking = 1;
                        game.talkface(checkface(), 1);
                        talk(map1girl);
                        map1girl++;

                        if (map1girl == 7 && env == 0)
                        {

                            get_item(1);

                            back2.URL = ("item.mp3");
                            back2.Ctlcontrols.play();

                            label9.Text = "獲得哈密瓜.";
                            talk(map1girl);
                            map1girl++;
                            env = 1;

                        }
                        else if (map1girl == 5 && env == 0)
                        {

                            label9.Text = "小女孩:這是我撿到的一顆東西.";
                            talk(map1girl);
                            map1girl++;

                        }

                        else if (map1girl == 3)
                        {

                            label9.Text = "小女孩:嚇得我,趕快跑回家.";
                            talk(map1girl);
                            map1girl++;

                        }
                        else if (map1girl == 1)
                        {
                            label9.Text = "小女孩:我上次在後山看到一到閃光";

                            talk(map1girl);
                            map1girl++;
                        }

                        else { map1girl = 0; }
                    }
                    /////////////////////////////////////////////////
                    if (game.now_map == "Test.txt" && game.max_monster[0] == 1)
                    {
                        talking = 1;

                        game.talkface(checkface(), 0);
                        talk(map2boy);
                        map2boy++;

                        if (map2boy == 3)
                        {

                            label9.Text = "統神哥哥:你也想去試試看?";

                            talk(map2boy);
                            map2boy++;


                        }
                        else if (map2boy == 1)
                        {

                            label9.Text = "統神哥哥:我弟弟在野區找人單挑";
                            talk(map2boy);
                            map2boy++;
                        }

                        else { map2boy = 0; }
                    }

                }
            }
        }
        private void check_item()
        {
            StreamReader sr = new StreamReader(@"item.txt");
            string a;
            //===逐行讀取,直到檔尾===
            item = 0;
            while (!sr.EndOfStream)
            {
                a = sr.ReadLine();
                string[] strArray = a.Split(',');
                for (int i = 0; i < strArray.Length; i++)        //透過迴圈將陣列值取出 也可用foreach
                {
                    if (strArray[i].ToString() == "1")
                    {


                        labx[item].Text = "哈密瓜"; itemarr[item] = strArray[i].ToString();
                    }

                    else { labx[item].Text = strArray[i].ToString(); itemarr[item] = strArray[i].ToString(); }
                    item++;
                }
            }

            if (min >= 0)
                if (itemarr[min] == "1")
                    labx[12].Text = "有一點哈味不過還能吃.";
                else
                    labx[12].Text = labx[min].Text;



            sr.Close();
        }
        int zero;
        string all_item;
        private void delate_item(int item)
        {

            for (int i = 0; i < 12; i++)
            {
                all_item += itemarr[i];
                if ((i + 1) % 3 == 0)
                {
                    all_item += "\r\n";
                }
                else
                    all_item += ",";
            }
            all_item = all_item.Replace(item.ToString(), "-");
            StreamWriter sw = new StreamWriter(@"item.txt", false);
            //第二個參數設定為true表示不覆蓋原本的內容,把新內容直接添加進去
            sw.Write(all_item);
            sw.Flush();
            sw.Close();
            all_item = null;
        }
        private void get_item(int item)
        {

            for (int i = 0; i < 12; i++)
            {

                if (itemarr[i] == "-")
                { zero = i; break; }
            }
            if (item == 1)
                itemarr[zero] = "1";
            for (int i = 0; i < 12; i++)
            {
                all_item += itemarr[i];

                if ((i + 1) % 3 == 0)
                {
                    all_item += "\r\n";
                }

                else
                    all_item += ",";
            }

            StreamWriter sw = new StreamWriter(@"item.txt", false);
            //第二個參數設定為true表示不覆蓋原本的內容,把新內容直接添加進去
            sw.Write(all_item);
            sw.Flush();
            sw.Close();
            all_item = null;

        }
        int pok_length;
        string all_pok;
        private void check_pok()
        {
            StreamReader sr = new StreamReader(@"pok.txt");
            string a;
            //===逐行讀取,直到檔尾===
            item = 0;
            while (!sr.EndOfStream)
            {
                a = sr.ReadLine();
                string[] strArray = a.Split(',');
                for (int i = 0; i < strArray.Length; i++)        //透過迴圈將陣列值取出 也可用foreach
                {
                    pokarr[item] = strArray[i].ToString();
                    item++;
                }

                pok_length = strArray.Length;
            }

            sr.Close();

        }
        private void set_pok()
        {

            for (int i = 0; i < 12; i++)
            {
                all_pok += pokarr[i];
                if ((i + 1) % 2 == 0)
                {
                    all_pok += "\r\n";
                }
                else
                    all_pok += ",";
            }

            StreamWriter sw = new StreamWriter(@"pok.txt", false);
            //第二個參數設定為true表示不覆蓋原本的內容,把新內容直接添加進去
            sw.Write(all_pok);
            sw.Flush();
            sw.Close();
            all_pok = null;

        }
        private void talk(int tmp)
        {

            if (tmp == 0 || tmp % 2 == 0)
            {
                pictureBox2.Visible = false;
                label9.Visible = false;
                enving = 0;
                talking = 0;
            }
            else if (tmp % 2 == 1)
            {

                pictureBox2.Visible = true;
                label9.Visible = true;
                enving = 1;
                talking = 1;
            }


        }
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            Bitmap srcBitmap = new Bitmap("pok/" + "player2.png");// bitmap 為你的原圖
            Bitmap destBitmap = new Bitmap(srcBitmap.Width, srcBitmap.Height);
            // destBitmap 為你的目的圖檔,長、寬為原圖1/3 
            Rectangle destRect = new Rectangle(0, 0, destBitmap.Width / 3, destBitmap.Height / 4); // 你的輸出範圍
            Rectangle srcRect = new Rectangle(43, 0, srcBitmap.Width / 3, srcBitmap.Height / 4); // 你的原圖剪裁區域
            Graphics.FromImage(destBitmap).DrawImage(srcBitmap, destRect
            , srcRect, GraphicsUnit.Pixel);
            pictureBox1.Image = destBitmap;
        }


        private void timer2_Tick(object sender, EventArgs e)
        {

            if (start == 1)
            {
                if (game.fight == 1)
                {
                    wmp.Ctlcontrols.pause();
                    if (game.atack.over2() == 1)
                    {
                        game.View(false);
                        wmp.Ctlcontrols.play();
                        game.fight = 0;
                    }
                }
                if (game.changemaptest == 1)
                {

                    if (game.now_map == "Test.txt")
                    {
                        wmp.URL = "sound/theme.mp3";
                        wmp.Ctlcontrols.play();
                        timer5.Enabled = true;
                        game.changemaptest = 0;


                    }
                    if (game.now_map == "Test2.txt")
                    {
                        wmp.URL = "sound/101.mp3";
                        wmp.Ctlcontrols.play();
                        timer5.Enabled = true;
                        game.changemaptest = 0;
                    }
                    if (game.now_map == "Test3.txt")
                    {
                        wmp.URL = "sound/well.mp3";
                        wmp.Ctlcontrols.play();
                        timer5.Enabled = true;
                        game.changemaptest = 0;
                    }
                }
                label2.Text = game.INL.ToString() + "\r" + game.plx.ToString() + ":" + game.ply.ToString() + "\r" + game.msx + ":" + game.msy + "\n" + game.face.ToString() + "\n" + game.pb1x.ToString();
            }
        }


        private void timer3_Tick(object sender, EventArgs e)
        {
            if (start == 1)
                if (game.now_map == "Test.txt" && enving == 0)
                {

                    if (game.times < 6)
                    {
                        if (game.npcmove2(3, 0, 1) == 1)
                            game.times++;

                    }
                    if (game.times >= 6 && game.times < 12)
                    {

                        if (game.npcmove(1, 0, 1) == 1)
                            game.times++;

                    }
                    if (game.times >= 12 && game.times < 18)
                    {

                        if (game.npcmove2(4, 0, 1) == 1)
                            game.times++;
                    }
                    if (game.times >= 18 && game.times < 24)
                    {

                        if (game.npcmove(2, 0, 1) == 1)
                            game.times++;
                    }
                    if (game.times >= 24)
                    { game.times = 0; }
                }
        }

        private void Form1_KeyUp(object sender, KeyEventArgs e)
        {
            try
            {
                if (game.loding == 1)
                {

                    ProcessMutilKey(keyboardtmp.KeyCode, true);
                }
            }
            catch
            { }
        }
        private void ProcessMutilKey(Keys MutilKey, bool DownOrUp)
        {
            if (talking == 0)
            {
                // 當觸發 A, Ctrl, Alt 鍵時,若為 KeyDown 則把該所屬的旗標設為 true,
                // 反之,若為 KeyUp 時則把該所屬的旗標設為 false
                if (MutilKey == Keys.Up)
                    IsADown = DownOrUp;
                if (MutilKey == Keys.Down)
                    IsADown = DownOrUp;
                if (MutilKey == Keys.Right)
                    IsADown = DownOrUp;
                if (MutilKey == Keys.Left)
                    IsADown = DownOrUp;
                if (IsADown == true)
                {

                    IsADown = false;
                    game.handlekeypress2(keyboardtmp);
                }
            }
        }


        private void pictureBox2_VisibleChanged(object sender, EventArgs e)
        {
            back.URL = ("sound/menu.wav");
            back.Ctlcontrols.play();
        }

        private void pictureBox3_VisibleChanged(object sender, EventArgs e)
        {
            back.URL = ("sound/menu2.wav");
            back.Ctlcontrols.play();
        }

        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {

            back.URL = ("sound/menu.wav");
            back.Ctlcontrols.play();
        }

        private void pictureBox4_Move(object sender, EventArgs e)
        {

            back.URL = ("sound/menu.wav");
            back.Ctlcontrols.play();
        }


        private void pictureBox5_VisibleChanged(object sender, EventArgs e)
        {
            back.URL = ("sound/menu.wav");
            back.Ctlcontrols.play();

        }



        private void back2_StatusChange(object sender, EventArgs e)
        {
            if ((int)back2.playState == 1)//如果播放状态等于停止
            {
                wmp.Ctlcontrols.play();
                //这里写你的处理代码
            }
            if (back2.playState == WMPLib.WMPPlayState.wmppsPlaying)//如果播放状态等于停止
            {
                wmp.Ctlcontrols.stop();
                //这里写你的处理代码
            }
        }

        private void wmp_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
        {
            if (e.newState == 1)
                this.wmp.Ctlcontrols.play();
        }

        private static Bitmap Process(Bitmap originImage, int oriwidth, int oriheight, int width, int height)
        {
            Bitmap resizedbitmap = new Bitmap(width, height);
            Graphics g = Graphics.FromImage(resizedbitmap);
            g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            g.Clear(Color.Transparent);
            g.DrawImage(originImage, new Rectangle(0, 0, width, height), new Rectangle(0, 0, oriwidth, oriheight), GraphicsUnit.Pixel);
            return resizedbitmap;
        }
        public static Bitmap Resize(Bitmap originImage, Double times)
        {
            int width = Convert.ToInt32(originImage.Width * times);
            int height = Convert.ToInt32(originImage.Height * times);

            return Process(originImage, originImage.Width, originImage.Height, width, height);
        }
        public Bitmap TakeScreenshot(int y, int x, Bitmap bmpx, int cutx1, int cutx2, int cuty1, int cuty2, double multiple)
        {
            Bitmap destBitmap = new Bitmap(bmpx.Width, bmpx.Height);
            Rectangle destRect = new Rectangle(0, 0, destBitmap.Width / cutx1, destBitmap.Height / cuty1); // 你的輸出範圍
            Rectangle srcRect = new Rectangle(y, x, bmpx.Width / cutx1, bmpx.Height / cuty2); // 你的原圖剪裁區域
            Graphics.FromImage(destBitmap).DrawImage(bmpx, destRect, srcRect, GraphicsUnit.Pixel);
            return Resize(destBitmap, multiple);
        }

        private void timer5_Tick(object sender, EventArgs e)
        {
            if (start2 >= 5 && start == 0)
            {

                timer5.Dispose();

                start2 = 0;
                start = 1;
                game = new Class1(this);
                label6.Dispose();

            }

            if (start2 % 2 == 0 && start == 0)
                label6.ForeColor = Color.White;
            else if (start2 % 2 == 1)
                label6.ForeColor = Color.Black;

            start2 += 1;

        }

        private void pictureBox5_VisibleChanged_1(object sender, EventArgs e)
        {
            back.URL = ("sound/menu2.wav");
            back.Ctlcontrols.play();
        }
        Bitmap bmp2;
        private void pictureBox6_Paint(object sender, PaintEventArgs e)
        {
            check_pok(); if (pokarr[2] != "-1")
            {
                bmp2 = new Bitmap("pok/" + pokarr[2] + ".png");
                label7.Text = pokarr[3];
                e.Graphics.DrawImage(TakeScreenshot(0, 0, bmp2, 1, 1, 1, 1, 0.7), 40, 0);

            }


            PictureBox pb = (PictureBox)sender;
            if (menu2y == pb.Location.Y)
            {
                pokarr[0] = "0";
                set_pok();
                e.Graphics.DrawRectangle(new Pen(Color.Red, 15), 0, 0, pb.Width, pb.Height);
                bmp2 = new Bitmap("pok/" + pokarr[2] + ".png");
                pictureBox5.Refresh();
            }

        }

        private void pictureBox7_Paint(object sender, PaintEventArgs e)
        {
            check_pok(); if (pokarr[4] != "-1")
            {
                bmp2 = new Bitmap("pok/" + pokarr[4] + ".png");
                label8.Text = pokarr[5];
                e.Graphics.DrawImage(TakeScreenshot(0, 0, bmp2, 1, 1, 1, 1, 0.7), 40, 0);
            }



            back.URL = ("sound/menu.wav");
            back.Ctlcontrols.play();
            PictureBox pb = (PictureBox)sender;
            if (menu2y == pb.Location.Y)
            {
                pokarr[0] = "1";
                set_pok();
                e.Graphics.DrawRectangle(new Pen(Color.Red, 15), 0, 0, pb.Width, pb.Height);
                bmp2 = new Bitmap("pok/" + pokarr[4] + ".png");
                pictureBox5.Refresh();
            }
        }

        private void pictureBox8_Paint(object sender, PaintEventArgs e)
        {
            check_pok(); if (pokarr[6] != "-1")
            {
                bmp2 = new Bitmap("pok/" + pokarr[6] + ".png");
                label10.Text = pokarr[7];
                e.Graphics.DrawImage(TakeScreenshot(0, 0, bmp2, 1, 1, 1, 1, 0.7), 40, 0);
            }



            back.URL = ("sound/menu.wav");
            back.Ctlcontrols.play();
            PictureBox pb = (PictureBox)sender;
            if (menu2y == pb.Location.Y)
            {
                pokarr[0] = "2";
                set_pok();
                e.Graphics.DrawRectangle(new Pen(Color.Red, 15), 0, 0, pb.Width, pb.Height);
                bmp2 = new Bitmap("pok/" + pokarr[6] + ".png");
                pictureBox5.Refresh();
            }
        }

        private void pictureBox9_Paint(object sender, PaintEventArgs e)
        {
            check_pok(); if (pokarr[8] != "-1")
            {
                bmp2 = new Bitmap("pok/" + pokarr[8] + ".png");
                label11.Text = pokarr[9];
                e.Graphics.DrawImage(TakeScreenshot(0, 0, bmp2, 1, 1, 1, 1, 0.7), 40, 0);
            }



            back.URL = ("sound/menu.wav");
            back.Ctlcontrols.play();
            PictureBox pb = (PictureBox)sender;
            if (menu2y == pb.Location.Y)
            {
                pokarr[0] = "3";
                set_pok();
                e.Graphics.DrawRectangle(new Pen(Color.Red, 15), 0, 0, pb.Width, pb.Height);
                bmp2 = new Bitmap("pok/" + pokarr[8] + ".png");
                pictureBox5.Refresh();
            }
        }

        private void pictureBox10_Paint(object sender, PaintEventArgs e)
        {
            check_pok(); if (pokarr[10] != "-1")
            {
                bmp2 = new Bitmap("pok/" + pokarr[10] + ".png");
                label12.Text = pokarr[11];
                e.Graphics.DrawImage(TakeScreenshot(0, 0, bmp2, 1, 1, 1, 1, 0.7), 40, 0);

            }



            back.URL = ("sound/menu.wav");
            back.Ctlcontrols.play();
            PictureBox pb = (PictureBox)sender;
            if (menu2y == pb.Location.Y)
            {
                pokarr[0] = "4";
                set_pok();
                e.Graphics.DrawRectangle(new Pen(Color.Red, 15), 0, 0, pb.Width, pb.Height);
                bmp2 = new Bitmap("pok/" + pokarr[10] + ".png");
                pictureBox5.Refresh();
            }
        }

        private void timer1_Tick(object sender, EventArgs e)
        {

        }

        private void timer4_Tick(object sender, EventArgs e)
        {

        }

        private void pictureBox5_Paint(object sender, PaintEventArgs e)
        {

            e.Graphics.DrawImage(TakeScreenshot(0, 0, bmp2, 1, 1, 1, 1, 2), 20, 0);

        }
    }
}

Program.cs

csharp
using System;
using System.Collections.Generic;
//using System.Linq;

using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }
}