c#连连看游戏

时间:2017-04-08 09:55:16
【文件属性】:
文件名称:c#连连看游戏
文件大小:310KB
文件格式:RAR
更新时间:2017-04-08 09:55:16
c# 游戏 源码 源码,vs2010开发。部分代码: private void Form1_Load(object sender, EventArgs e) { Source = (Bitmap)Image.FromFile("..\\..\\res\\animal.bmp"); this.pictureBox1.Height = W * (m_nRow + 2); this.pictureBox1.Width = W * (m_nCol+2); this.pictureBox1.Top = 0; this.pictureBox1.Left = 0; //当前窗体标题栏高度 int d = (this.Height - this.ClientRectangle.Height); this.Height = this.pictureBox1.Height + this.pictureBox1.Top+ d; this.Width = this.pictureBox1.Width + this.pictureBox1.Left ; //for (int i = 0; i < 10 * 10; i++) //{ // m_map[i] = i % 6; //} StartNewGame(); Init_Graphic(); } private void StartNewGame() { //初始化地图,将地图中所有方块区域位置置为空方块状态 for(int iNum=0;iNum<(m_nCol*m_nRow);iNum++) { m_map[iNum] = BLANK_STATE; } Random r = new Random(); //生成随机地图 //将所有的动物物种放进一个临时的地图tmpMap中 ArrayList tmpMap=new ArrayList (); for(int i=0;i<(m_nCol*m_nRow)/4;i++) for(int j=0;j<4;j++) tmpMap.Add(i); //每次从上面的临时地图tmpMap中取走(获取后并在临时地图删除) //一个动物放到地图的空方块上 for (int i = 0; i < m_nRow * m_nCol; i++) { //随机挑选一个位置 int nIndex = r.Next() % tmpMap.Count ; //获取该选定物件放到地图的空方块 m_map[i]=(int)tmpMap[nIndex]; //在临时地图tmpMap除去该动物 tmpMap.RemoveAt(nIndex); } } private void Init_Graphic() { Graphics g = get_Graphic(); //生成Graphics对象 for (int i = 0; i< 10 * 10; i++) { g.DrawImage(create_image(m_map[i]), W * (i % GameSize)+W, W * (i / GameSize)+W, W, W); } }
【文件预览】:
连连看游戏
----bin()
--------Debug()
----Form1.Designer.cs(3KB)
----UpgradeLog.XML(4KB)
----res()
--------animal.bmp(378KB)
--------grayFrame.bmp(3KB)
--------skyblue_LLK.ico(1KB)
--------3DFrames.bmp(54KB)
--------animal2.bmp(149KB)
--------Thumbs.db(11KB)
--------animal3.bmp(149KB)
--------blueFrame.bmp(3KB)
--------skyblue_LLK.rc2(403B)
----Program.cs(468B)
----skyblue_LLK.ico(1KB)
----obj()
--------连连看.csproj.FileList.txt(282B)
--------Debug()
----连连看.suo(16KB)
----Resources()
----连连看.sln(907B)
----Form1.cs(24KB)
----绘图1.vsd(57KB)
----连连看.csproj(4KB)
----Form1.resx(6KB)
----绘图2.vsd(68KB)
----Properties()
--------Resources.resx(6KB)
--------Settings.settings(249B)
--------AssemblyInfo.cs(1KB)
--------Settings.Designer.cs(1KB)
--------Resources.Designer.cs(3KB)

网友评论

  • 实现基本功能,存在一些bug
  • 源代码结构清晰,语法也够规范的,就是注释较少
  • 还是很不错的一个,正在努力理解中....
  • 还是很不错的一个,源码还行。