C#打字游戏课程设计复习过程.docVIP

  • 17
  • 0
  • 约1.13万字
  • 约 13页
  • 2020-04-19 发布于浙江
  • 举报
C#打字游戏课程设计 C# 打字游戏 程序核心代码主要部分: 打字游戏 打字游戏 掉落间隔 掉落速度 键盘事件 计时器 倒计时 系统时间 错误 正确 设计程序流程图: 选择 选择 开始/退出 主窗口 暂停/继续 (计时器) 选择退出 游戏 开始/结束 (计时器运行) 游戏中… (键盘事件) (核心) 游戏结束 跳出成绩 程序结束 中途 结束 时间设置窗体 成绩显示窗体 程序截图: 主窗体代码: 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; //课程名称 C# 程序设计实践 //设计题目 打字游戏 //专业 计算机科学与技术 //班级 //学号 //姓名 //指导老师 namespace Typing_Game { public partial class FrmTyping : Form { public FrmTyping() { InitializeComponent(); } public int right = 0; //正确个数计数 public int wrong = 0; //错误个数计数 public int sum = 0; //总个数技术 public int count = 0; //按键总次数 public float accuracy; //正确率 public int Minute = 1; //设置默认没局游戏时间 public int minute; //设置游戏中的倒计时 分 public int second; //设置游戏中的倒计时 秒 private void FrmTyping_Load(object sender, EventArgs e) { } //在状态栏中显示当前系统时间 private void timerSys_Tick(object sender, EventArgs e) { DateTime now = DateTime.Now; this.tsslSysTime.Text = 系统时间: + now.Hour.ToString() + : + now.Minute.ToString() + : + now.Second.ToString()+\t; } //开始结束按钮 private void tsmiStratOrOver_Click(object sender, EventArgs e) { if (tsmiStratOrOver.Text == 开始) { tsmiStratOrOver.Text = 结束; timerWord.Start(); timerGame.Start(); timerGT.Start(); //在游戏开始时 暂停继续 按钮可用 tsmiPauseOrContinue.Enabled = true; //在游戏未开始时 选择游戏等级 与设置游戏 按钮无效 tsmiLevel.Enabled = false; tsmiOption.Enabled = false; //游戏开始 初始化游戏数据 right = 0; wrong = 0; sum = 0; c

文档评论(0)

1亿VIP精品文档

相关文档