资源简介
叠方块游戏源码
源码描述:
界面出现后,点击开始按钮开始游戏,把鼠标移动到游戏区域,鼠标变为十字,
这时候单击左键,方块停止移动,如果方块停止时,它和它所在行的下面所有行都能被一条直线串起来,
那么继续游戏,同时方块所在行的上一行出现新的方块移动,否则游戏结束
方块分布为4443332211(注:第一层4个,第十层1个)
越往上移动速度越快,方块越少,难度会越来越大
欢迎感兴趣的用户下载学习

代码片段和文件信息
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;
//下载于51aspx.com
namespace RectGame
{
public partial class MainForm : Form
{
// int mTimeInterval = 0;//时间间隔
int mPBWidth = 0; //绘图控件的宽
int mPBHeight = 0; //绘图控件的高
int mGridHeight = 27;//网格的宽高
int mGridWidth = 27;
bool[] isFill; //记录每个格子是否被填充
bool IsLeft = false; //方块是否往左运动
int clickNum; //点击次数 增加难度用
int tempX;
int tempY;
int tempLenNum; //方块占几个格子
Graphics mGraphics;
public MainForm()
{
InitializeComponent();
clickNum = 0;
isFill = new bool[10 10];
tempX = 0;
tempY = mGridHeight * 9;
tempLenNum = 4; //初始化方块的长度
timer1.Interval =85;
mPBWidth = pictureBox1.Width;//获取图像控件的高和宽
mPBHeight = pictureBox1.Height;
mGraphics = pictureBox1.CreateGraphics();
}
//绘制网格
private void DrawGrid(int mPBWidth int mPBHeight Graphics g int mGridHeight int mGridWidth)
{
SolidBrush pBrush = new SolidBrush(Color.Green);
Pen p = new Pen(pBrush);
for (int i = 0; i <= mPBWidth / mGridWidth; i++)
{
g.DrawLine(p i * mGridHeight 0 i * mGridHeight mPBHeight);
}
for (int j = 0; j <= mPBHeight / mGridHeight; j++)
{
g.DrawLine(p 0 j * mGridWidth mPBWidth j * mGridWidth);
}
}
private void pictureBox1_Paint(object sender PaintEventArgs e)
{
DrawRect(tempX tempY tempLenNum e.Graphics);
DrawFilledRect(isFill e.Graphics);
DrawGrid(mPBWidth mPBHeighte.Graphics 27 27);//绘制网格
}
private void btnStart_Click(object sender EventArgs e)
{
clickNum = 0;
isFill = new bool[10 10];
tempX = 0;
tempY = mGridHeight * 9;
tempLenNum = 4; //初始化方块的长度
timer1.Interval = 85;
pictureBox1.CreateGraphics().Clear(pictureBox1.BackColor);
tempX = 0;
tempY = mGridHeight * 9;
timer1.Enabled = true;
timer1.Start();
//绘制最下面一行的方块 从左往右移动 长度=4
// DrawMoveRect(10 4 mGraphics);
}
///
/// 填充第row行 长度为p的长方形
///
///
///
private void DrawRect(int tempXint tempYint pGraphics pGraphics)
{
SolidBrush mBrush=new SolidBrush(Color.Red);
pGraphics.FillRectangle(mBrushtempX tempY mGrid
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
....... 30720 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\bin\Debug\RectGame.exe
....... 26112 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\bin\Debug\RectGame.pdb
....... 14328 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\bin\Debug\RectGame.vshost.exe
....... 490 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\bin\Debug\RectGame.vshost.exe.manifest
....... 30720 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\bin\Release\RectGame.exe
....... 28160 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\bin\Release\RectGame.pdb
....... 14328 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\bin\Release\RectGame.vshost.exe
....... 490 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\bin\Release\RectGame.vshost.exe.manifest
....... 6896 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\Form1.cs
....... 3732 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\Form1.Designer.cs
....... 6008 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\Form1.resx
....... 1890 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\obj\Debug\RectGame.csproj.FileListAbsolute.txt
....... 890 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\obj\Debug\RectGame.csproj.GenerateResource.Cache
....... 30720 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\obj\Debug\RectGame.exe
....... 180 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\obj\Debug\RectGame.MainForm.resources
....... 26112 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\obj\Debug\RectGame.pdb
....... 19472 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\obj\Debug\RectGame.Properties.Resources.resources
....... 4608 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
....... 638 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\obj\Release\RectGame.csproj.FileListAbsolute.txt
....... 890 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\obj\Release\RectGame.csproj.GenerateResource.Cache
....... 30720 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\obj\Release\RectGame.exe
....... 180 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\obj\Release\RectGame.MainForm.resources
....... 28160 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\obj\Release\RectGame.pdb
....... 19472 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\obj\Release\RectGame.Properties.Resources.resources
....... 4608 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\obj\Release\TempPE\Properties.Resources.Designer.cs.dll
....... 492 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\Program.cs
....... 1369 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\Properties\AssemblyInfo.cs
....... 3097 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\Properties\Resources.Designer.cs
....... 6205 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\Properties\Resources.resx
....... 1093 2012-09-26 10:56 51aspx_RangeBlockGamec8f7f815-7484-4469-bf0b-a2b92472da5a\Properties\Settings.Designer.cs
............此处省略19个文件信息
相关资源
- Scratch源码
- E4A无障碍跨程序操作类库(带源码、
- 设备管理系统源码
- 安卓wifi直连app源码
- flash3.0小游戏
- Scrach 欢乐狙击手.sb2
- 我的世界源码(易语言版)
- labview编程软件滤波器以及编写程序设
- 我的界面(visual foxpro)源码
- 易语言:一键cf基址源码
- The Secret Path 3D 3D魔方迷宫[源码][scra
- scratch垃圾分类源码(最终版本).sb
- 安卓QQ6.71协议源码易语言,qq协议源码
- 编译原理实验工具及参考源码(lex&
- E盾偷后台工具源码
- UNIX/LINUX编程实践教程的源码
- 十以内加减法练习 powerbuilder源码
- linux应用层的华容道游戏源代码
- 农场开发项目
- OCR源码
- PLC上位机编程软件
- 用foobar2000听google音乐[更新一下]
- 学生信息管理系统源码
- 用VC 编写的仿QQ聊天室程序源代码
- 毕业论文之温度传感器DS18B20(源码
- 可自定义导航网站源码
- 栅栏填充算法源码(VC)
- msp430F149操作红外接收模块源码
- [免费]图像识别c 源码
- 小鸡快跑游戏.
评论
共有 条评论