C#俄罗斯方块

考虑三个主要事件来实现游戏开发中描述的行为:
(1) 窗体加载时候,创建第一个方块
(2) 窗体的KeyPress事件可以处理来自用户的输入
(3) 定时器控件实现“每个时钟设置点调用Down方法”产生预想的下落效果

伪码如下所示

Form_Load
Creates an object (named currentBlock) of block class

Form_KeyPress
If left Arrow was pressed , call left method of currentBlock
If right Arrow was pressed , call right method of currentBlock
If up Arrow was pressed , call rotate method of currentBlock
If down Arrow was pressed , call down method of currentBlock


TimerTick
If there is no block below currentBlock ,
and the currentBlock didn't reach the bottom of the screen then
Call the down method of currentBlock
Else
Stop the block
If it's at the top of the screen then
The Game is over
If we filled any horizontal lines then
Increase the Game Score
Erase the line
Create a new block at the top of the screen

编码阶段
概略设计 : 编写 square 类
第二阶段设计 : 编写block类
最终设计 : 编写GameField和游戏引擎
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
首先说说咱们的学习的大概的规划: 第一步、我们先简单的理解下俄罗斯游戏开发的大概算法和需要的知识,然后把这些知识组 合开发一个小小的俄罗斯游戏Demo。基本上实现俄罗斯方块游戏的控制和操作。 第二步、我们在我们的Demo的基础上,尽可能的提出对我们的算法进行优化。对我们的界面 进行美化,功能进行扩展。从一个简单的Demo变成一个可玩性很强的单机版俄罗斯 方块小游戏。 第三步、我们来尝试把单机版俄罗斯方块做成一个俩人联机版游戏,利用SOCKET通信,让咱 们的俄罗斯方块实现可以双人玩。我们主要使用point-to-point方式来玩。一个当做 服务器端一个当做客户端来玩。 第四步、我们把我们的简单联机版俄罗斯方块做成一个带游戏大厅的服务端和客户端多人连 接俄罗斯方块游戏。让更多的人加入我们来玩。 第五步、从可盈利出发。我们研究深入研究俄罗斯游戏可能产生的盈利模式,我们将在俄罗 斯游戏中把我们的盈利模式实现,我们将在我们的游戏中增加其他的一些道具,而 这些道具有可能需要稍微改变下游戏的规则。至此为止,我们就可以依托一个点逐 渐的拓展成一个面,完成一个俄罗斯方块游戏商业模式。 而这只是第一个DEMO http://blog.csdn.net/aofengdaxia/archive/2010/02/09/5301934.aspx 来深入学习和了解
C#做的俄罗斯方块游戏using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Xml; using System.IO; using System.Security.Cryptography; using System.Text; using System.Runtime.Serialization.Formatters.Binary; namespace RussiaBlock { public class MainForm : System.Windows.Forms.Form { #region 变量 private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel panel2; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label3; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button3; private System.Windows.Forms.Button button4; private System.Windows.Forms.Timer timer1; private Block block; private Block nextBlock; private int nextShapeNO; private bool paused; private DateTime atStart; private DateTime atPause; private TimeSpan pauseTime; private System.Windows.Forms.Panel panel3; private System.Windows.Forms.TextBox textBox1; private ControlForm sform; private Keys[] keys; private System.Windows.Forms.Label label4; private int level; private int startLevel; private bool trans; private int rowDelNum; private bool failed; private System.Windows.Forms.Label label5; private System.Windows.Forms.MainMenu mainMenu1; private System.Windows.Forms.MenuItem menuItem1; private System.Windows.Forms.MenuItem menuItem2; private System.Windows.Forms.MenuItem menuItem3; private System.Windows.Forms.MenuItem menuItem4; private System.Windows.Forms.MenuItem menuItem5; private System.Windows.Forms.MenuItem menuItem6; private AxWMPLib.AxWindowsMediaPlayer axMediaPlayer1; private System.Windows.Forms.MenuItem menuItem7; private System.ComponentModel.IContainer components; #endregion public MainForm() { InitializeComponent(); } protected override void Dispose( bool disposing ) { if( disposing ) { if(component

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值