Exemplo n.º 1
0
        public override void Init()
        {
            m_x1    = 10;
            m_x2    = 11;
            m_y1    = 9;
            m_y2    = 11;
            m_icon  = 1;
            m_mmx   = 4;
            m_mmdir = 1;
            go      = new CGameOutput(25, 20);
            //设置图素
            go.SetPixel(" 喵版马里奥开始游戏选择关卡■●");
            //创建图片
            CBmp bmp1 = new CBmp();
            CBmp bmp2 = new CBmp();
            CBmp bmp3 = new CBmp();
            CBmp bmp4 = new CBmp();
            CBmp bmp5 = new CBmp();
            CBmp bmp6 = new CBmp();
            CBmp bmp7 = new CBmp();
            CBmp bmp8 = new CBmp();

            //设置图片数据
            bmp1.SetBmpData(9, 1, 1, 0, 2, 0, 3, 0, 4, 0, 5);
            bmp2.SetBmpData(4, 1, 6, 7, 8, 9);
            bmp3.SetBmpData(4, 1, 10, 11, 12, 13);
            bmp4.SetBmpData(25, 2, 14);
            bmp5.SetBmpData(2, 3, 14);
            bmp6.SetBmpData(4, 1, 6, 7, 8, 9);
            bmp7.SetBmpData(4, 1, 10, 11, 12, 13);
            bmp8.SetBmpData(1, 1, 15);
            //设置图片颜色
            bmp1.SetBmpBackColocr(ConsoleColor.Red, ConsoleColor.DarkBlue, ConsoleColor.Red, ConsoleColor.DarkBlue, ConsoleColor.Red, ConsoleColor.DarkBlue, ConsoleColor.Red, ConsoleColor.DarkBlue, ConsoleColor.Red);
            bmp2.SetBmpBackColocr(ConsoleColor.Yellow);
            bmp3.SetBmpBackColocr(ConsoleColor.Yellow);
            bmp4.SetBmpBackColocr(ConsoleColor.White);
            bmp5.SetBmpBackColocr(ConsoleColor.Green);
            bmp6.SetBmpBackColocr(ConsoleColor.Yellow);
            bmp7.SetBmpBackColocr(ConsoleColor.Yellow);
            bmp8.SetBmpBackColocr(ConsoleColor.DarkBlue);

            bmp1.SetBmpForeColocr(ConsoleColor.White, ConsoleColor.DarkBlue, ConsoleColor.White, ConsoleColor.DarkBlue, ConsoleColor.White, ConsoleColor.DarkBlue, ConsoleColor.White, ConsoleColor.DarkBlue, ConsoleColor.White);
            bmp2.SetBmpForeColocr(ConsoleColor.Black);
            bmp3.SetBmpForeColocr(ConsoleColor.Black);
            bmp4.SetBmpForeColocr(ConsoleColor.DarkRed);
            bmp5.SetBmpForeColocr(ConsoleColor.Green);
            bmp6.SetBmpForeColocr(ConsoleColor.White);
            bmp7.SetBmpForeColocr(ConsoleColor.White);
            bmp8.SetBmpForeColocr(ConsoleColor.Red);
            //加载图片
            go.LoadBmp("标题", bmp1);
            go.LoadBmp("开始", bmp2);
            go.LoadBmp("选择", bmp3);
            go.LoadBmp("砖块", bmp4);
            go.LoadBmp("水管", bmp5);
            go.LoadBmp("开始1", bmp6);
            go.LoadBmp("选择1", bmp7);
            go.LoadBmp("喵", bmp8);
            GameState = 2;
        }
Exemplo n.º 2
0
 //加载图片
 public void LoadBmp(string id, CBmp bmp)
 {
     //安全检测
     if (m_BmpList.ContainsKey(id))
     {
         return;
     }
     //将所需要加载的图片存入链表
     m_BmpList.Add(id, bmp);
 }
Exemplo n.º 3
0
        public override void Init()
        {
            CCommon.Score = 0;
            CCommon.win   = false;
            Mario         = new CHero(4, 16, "马里奥");
            //Client = new int[Client_S];
            Client_X = 0;
            Client_Y = 0;
            go       = new CGameOutput(25, 20);
            //初始化地面
            Ground    = new _MAP();
            Ground.x  = 0;
            Ground.y  = 17;
            Ground.w  = 80;
            Ground.h  = 2;
            Ground.id = "地面";
            //初始化地面2
            Ground2    = new _MAP();
            Ground2.x  = 88;
            Ground2.y  = 17;
            Ground2.w  = 15;
            Ground2.h  = 2;
            Ground2.id = "地面2";
            //陷阱
            XianJing    = new _MAP();
            XianJing.x  = -10;
            XianJing.y  = -10;
            XianJing.w  = 2;
            XianJing.h  = 1;
            XianJing.id = "陷阱";
            //陷阱
            XianJing1    = new _MAP();
            XianJing1.x  = 81;
            XianJing1.y  = 13;
            XianJing1.w  = 6;
            XianJing1.h  = 2;
            XianJing1.id = "陷阱1";
            //初始化地面
            Men    = new _MAP();
            Men.x  = 100;
            Men.y  = 14;
            Men.w  = 3;
            Men.h  = 3;
            Men.id = "门";

            Xin    = new _MAP();
            Xin.x  = -10;
            Xin.y  = -10;
            Xin.id = "心";

            #region 怪兽
            //怪兽
            GuaiShou       = new _MAP[3];
            GuaiShou[0].x  = 29;
            GuaiShou[0].y  = 16;
            GuaiShou[0].id = "怪兽0";
            GuaiShou[1].x  = 51;
            GuaiShou[1].y  = 16;
            GuaiShou[1].id = "怪兽1";
            GuaiShou[2].x  = 61;
            GuaiShou[2].y  = 16;
            GuaiShou[2].id = "怪兽2";
            #endregion

            #region 水管
            //初始化水管
            Pipe       = new _MAP[5];
            Pipe[0].x  = 30;
            Pipe[0].y  = 15;
            Pipe[0].w  = 2;
            Pipe[0].h  = 2;
            Pipe[0].id = "水管0";
            Pipe[1].x  = 42;
            Pipe[1].y  = 14;
            Pipe[1].w  = 2;
            Pipe[1].h  = 3;
            Pipe[1].id = "水管1";
            Pipe[2].x  = 52;
            Pipe[2].y  = 13;
            Pipe[2].w  = 2;
            Pipe[2].h  = 4;
            Pipe[2].id = "水管2";
            Pipe[3].x  = 62;
            Pipe[3].y  = 13;
            Pipe[3].w  = 2;
            Pipe[3].h  = 4;
            Pipe[3].id = "水管3";
            Pipe[4].x  = -10;
            Pipe[4].y  = -10;
            Pipe[4].w  = 2;
            Pipe[4].h  = 2;
            Pipe[4].id = "水管4";
            #endregion

            #region 金币砖
            //初始化金币
            Coin       = new _MAP[3];
            Coin[0].x  = 24;
            Coin[0].y  = 12;
            Coin[0].w  = 1;
            Coin[0].h  = 1;
            Coin[0].id = "金币0";
            Coin[1].x  = 23;
            Coin[1].y  = 7;
            Coin[1].w  = 1;
            Coin[1].h  = 1;
            Coin[1].id = "金币1";
            Coin[2].x  = 52;
            Coin[2].y  = 13;
            Coin[2].w  = 2;
            Coin[2].h  = 4;
            Coin[2].id = "金币2";
            #endregion

            #region 恶搞砖
            //初始化恶搞
            Spoof       = new _MAP[3];
            Spoof[0].x  = 16;
            Spoof[0].y  = 12;
            Spoof[0].w  = 1;
            Spoof[0].h  = 1;
            Spoof[0].id = "恶搞0";
            Spoof[1].x  = 22;
            Spoof[1].y  = 12;
            Spoof[1].w  = 1;
            Spoof[1].h  = 1;
            Spoof[1].id = "恶搞1";
            Spoof[2].x  = 74;
            Spoof[2].y  = 11;
            Spoof[2].w  = 1;
            Spoof[2].h  = 1;
            Spoof[2].id = "恶搞2";
            #endregion

            #region 空白砖
            //初始化空白
            Empty       = new _MAP[3];
            Empty[0].x  = 21;
            Empty[0].y  = 12;
            Empty[0].w  = 1;
            Empty[0].h  = 1;
            Empty[0].id = "空白0";
            Empty[1].x  = 23;
            Empty[1].y  = 12;
            Empty[1].w  = 1;
            Empty[1].h  = 1;
            Empty[1].id = "空白1";
            Empty[2].x  = 25;
            Empty[2].y  = 12;
            Empty[2].w  = 1;
            Empty[2].h  = 1;
            Empty[2].id = "空白2";
            #endregion

            //==========================================================================================
            //设置图素
            go.SetPixel(" ■●★⊕▲▼◆");
            //创建图片
            CBmp bmp1  = new CBmp();
            CBmp bmp2  = new CBmp();
            CBmp bmp3  = new CBmp();
            CBmp bmp4  = new CBmp();
            CBmp bmp5  = new CBmp();
            CBmp bmp6  = new CBmp();
            CBmp bmp7  = new CBmp();
            CBmp bmp8  = new CBmp();
            CBmp bmp9  = new CBmp();
            CBmp bmp10 = new CBmp();
            CBmp bmp11 = new CBmp();
            CBmp bmp12 = new CBmp();
            CBmp bmp13 = new CBmp();
            CBmp bmp14 = new CBmp();
            CBmp bmp15 = new CBmp();
            #region 图片属性
            //设置图片数据
            bmp1.SetBmpData(Ground.w, Ground.h, 1);
            bmp2.SetBmpData(1, 1, 2);
            bmp3.SetBmpData(Pipe[0].w, Pipe[0].h, 1);
            bmp4.SetBmpData(Pipe[1].w, Pipe[1].h, 1);
            bmp5.SetBmpData(Pipe[2].w, Pipe[2].h, 1);
            bmp6.SetBmpData(Pipe[3].w, Pipe[3].h, 1);
            bmp7.SetBmpData(Pipe[4].w, Pipe[4].h, 1);
            bmp8.SetBmpData(Spoof[0].w, Spoof[0].h, 1);
            bmp9.SetBmpData(Empty[0].w, Empty[0].h, 1);
            bmp10.SetBmpData(Ground2.w, Ground2.h, 1);
            bmp11.SetBmpData(1, 1, 3);
            bmp12.SetBmpData(1, 1, 4);
            bmp13.SetBmpData(2, 1, 5);
            bmp14.SetBmpData(XianJing1.w, XianJing1.h, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6);
            bmp15.SetBmpData(3, 3, 7, 7, 7, 7, 0, 7, 7, 0, 7);
            //设置图片颜色
            bmp1.SetBmpBackColocr(ConsoleColor.White);
            bmp2.SetBmpBackColocr(ConsoleColor.DarkBlue);
            bmp3.SetBmpBackColocr(ConsoleColor.Green);
            bmp4.SetBmpBackColocr(ConsoleColor.Green);
            bmp5.SetBmpBackColocr(ConsoleColor.Green);
            bmp6.SetBmpBackColocr(ConsoleColor.Green);
            bmp7.SetBmpBackColocr(ConsoleColor.Green);
            bmp8.SetBmpBackColocr(ConsoleColor.White);
            bmp9.SetBmpBackColocr(ConsoleColor.White);
            bmp10.SetBmpBackColocr(ConsoleColor.White);
            bmp11.SetBmpBackColocr(ConsoleColor.DarkBlue);
            bmp12.SetBmpBackColocr(ConsoleColor.DarkBlue);
            bmp13.SetBmpBackColocr(ConsoleColor.DarkBlue);
            bmp14.SetBmpBackColocr(ConsoleColor.DarkBlue);
            bmp15.SetBmpBackColocr(ConsoleColor.DarkBlue);

            bmp1.SetBmpForeColocr(ConsoleColor.DarkRed);
            bmp2.SetBmpForeColocr(ConsoleColor.Red);
            bmp3.SetBmpForeColocr(ConsoleColor.Green);
            bmp4.SetBmpForeColocr(ConsoleColor.Green);
            bmp5.SetBmpForeColocr(ConsoleColor.Green);
            bmp6.SetBmpForeColocr(ConsoleColor.Green);
            bmp7.SetBmpForeColocr(ConsoleColor.Green);
            bmp8.SetBmpForeColocr(ConsoleColor.DarkYellow);
            bmp9.SetBmpForeColocr(ConsoleColor.DarkRed);
            bmp10.SetBmpForeColocr(ConsoleColor.DarkRed);
            bmp11.SetBmpForeColocr(ConsoleColor.Yellow);
            bmp12.SetBmpForeColocr(ConsoleColor.Red);
            bmp13.SetBmpForeColocr(ConsoleColor.Black);
            bmp14.SetBmpForeColocr(ConsoleColor.Black);
            bmp15.SetBmpForeColocr(ConsoleColor.Cyan);
            //加载图片
            go.LoadBmp(Ground.id, bmp1);
            go.LoadBmp(Mario.GetName(), bmp2);
            go.LoadBmp(Pipe[0].id, bmp3);
            go.LoadBmp(Pipe[1].id, bmp4);
            go.LoadBmp(Pipe[2].id, bmp5);
            go.LoadBmp(Pipe[3].id, bmp6);
            go.LoadBmp(Pipe[4].id, bmp7);
            go.LoadBmp(Spoof[0].id, bmp8);
            go.LoadBmp(Spoof[1].id, bmp8);
            go.LoadBmp(Spoof[2].id, bmp8);
            go.LoadBmp(Coin[0].id, bmp8);
            go.LoadBmp(Coin[1].id, bmp8);
            go.LoadBmp(Empty[0].id, bmp9);
            go.LoadBmp(Empty[1].id, bmp9);
            go.LoadBmp(Empty[2].id, bmp9);
            go.LoadBmp(Ground2.id, bmp10);
            go.LoadBmp(GuaiShou[0].id, bmp11);
            go.LoadBmp(GuaiShou[1].id, bmp11);
            go.LoadBmp(GuaiShou[2].id, bmp11);
            go.LoadBmp(Xin.id, bmp12);
            go.LoadBmp(XianJing.id, bmp13);
            go.LoadBmp(XianJing1.id, bmp14);
            go.LoadBmp(Men.id, bmp15);
            #endregion
            //==========================================================================================================
            //游戏运行
            GameState = 2;
        }