电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

基于C#俄罗斯方块设计

基于C#俄罗斯方块设计_第1页
1/19
基于C#俄罗斯方块设计_第2页
2/19
基于C#俄罗斯方块设计_第3页
3/19
此程序主要三个小结讲解:1、 设计方块类(block.cs)2、 设计游戏类(game.cs)3、 设计窗体类(form1.cs)通俗易懂,希望对广阔的学生们都有帮助欢迎下载技术 qq 1278263100 邮箱 1278263100@qq.com游戏所需图片:游戏运行图:话不多说:设计方块类(block.cs)程序都有注释,通俗易懂using System;using System.Collections.Generic;using System.Text;using System.Drawing;//addnamespace 俄罗斯方块{ public class Block { private short width; private short height; private short top; private short left; private int ID; //方块部件的 ID public int[,] shape; //存储方块部件的形状,0为空白,1为有砖块 public Block()//构造函数 { Random randomGenerator = new Random(); int randomBlock = randomGenerator.Next(1, 5);//产生 1—4 的数 this.ID = randomBlock; switch (this.ID) { case 1: //横条形 this.Width = 4; this.Height = 1; this.Top = 0; this.Left = 3; shape = new int[this.Width, this.Height]; shape[0, 0] = 1; shape[1, 0] = 1; shape[2, 0] = 1; shape[3, 0] = 1; break; case 2: //正方形 this.Width = 2; this.Height = 2; this.Top = 0; this.Left = 4; // Creates the new shape for this block. shape = new int[this.Width, this.Height]; shape[0, 0] = 1; shape[0, 1] = 1; shape[1, 0] = 1;shape[1, 1] = 1; break; case 3: //T形 this.Width = 3; this.Height = 3; this.Top = 0; this.Left = 4; // Creates the new shape for this block. shape = new int[this.Width, this.Height]; shape[0, 0] = 1; shape[1, 0] = 1; shape[2, 0] = 1; shape[1, 1] = 1; shape[1, 2] = 1; break; case 4: //L 形 this.Width = 2; this.Height = 3; this.Top = 0; this.Left = 4; // Creates the new shape for this block. shape = new int[this.Width, this.Height]; shape[0, 0] = 1; shape[0, 1] = 1; shape[0, 2] = 1; shape[1, 2] = 1; break; } } public short Width//Width 属性 { get { return width; } set { width = value; } ...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

基于C#俄罗斯方块设计

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部