资源简介
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;
namespace SnakeGameDemo_zzy
{
public partial class Form1 : Form
{
Game g;
public Form1()
{
InitializeComponent();
this.button1.KeyDown += Form1_KeyDown;
}
private void Form1_KeyDown(object sender KeyEventArgs e)
{
switch (e.KeyData)
{
case Keys.W: if (g.direction == 2) return; g.direction = 1; break;
case Keys.S: if (g.direction == 1) return; g.direction = 2; break;
case Keys.A: if (g.direction == 4) return; g.direction = 3; break;
case Keys.D: if (g.direction == 3) return; g.direction = 4; break;
default: break;
}
}
private void button1_Click(object sender EventArgs e)
{
if (g != null)//防止按很多下gamestart
{ g.LetGameOver(); }
g = new Game(this.panel1.CreateGraphics() this.panel1.Width this.panel1.Height);
g.GameStart();
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 941 2011-12-15 17:53 SnakeGameDemo_zzy\SnakeGameDemo_zzy.sln
..A..H. 16384 2012-01-14 21:03 SnakeGameDemo_zzy\SnakeGameDemo_zzy.suo
文件 498 2011-12-15 17:53 SnakeGameDemo_zzy\SnakeGameDemo_zzy\Program.cs
文件 3815 2011-12-15 18:00 SnakeGameDemo_zzy\SnakeGameDemo_zzy\SnakeGameDemo_zzy.csproj
文件 11264 2011-12-15 18:50 SnakeGameDemo_zzy\SnakeGameDemo_zzy\bin\Debug\SnakeGameDemo_zzy.exe
文件 32256 2011-12-15 18:50 SnakeGameDemo_zzy\SnakeGameDemo_zzy\bin\Debug\SnakeGameDemo_zzy.pdb
文件 14328 2012-01-14 21:03 SnakeGameDemo_zzy\SnakeGameDemo_zzy\bin\Debug\SnakeGameDemo_zzy.vshost.exe
文件 490 2009-06-11 05:14 SnakeGameDemo_zzy\SnakeGameDemo_zzy\bin\Debug\SnakeGameDemo_zzy.vshost.exe.manifest
文件 1740 2012-01-14 21:03 SnakeGameDemo_zzy\SnakeGameDemo_zzy\obj\Debug\SnakeGameDemo_zzy.csproj.FileListAbsolute.txt
文件 11264 2011-12-15 18:50 SnakeGameDemo_zzy\SnakeGameDemo_zzy\obj\Debug\SnakeGameDemo_zzy.exe
文件 180 2011-12-15 18:35 SnakeGameDemo_zzy\SnakeGameDemo_zzy\obj\Debug\SnakeGameDemo_zzy.Form1.resources
文件 180 2011-12-15 18:00 SnakeGameDemo_zzy\SnakeGameDemo_zzy\obj\Debug\SnakeGameDemo_zzy.Properties.Resources.resources
文件 847 2011-12-15 18:45 SnakeGameDemo_zzy\SnakeGameDemo_zzy\obj\Debug\SnakeGameDemo_zzy.csproj.GenerateResource.Cache
文件 32256 2011-12-15 18:50 SnakeGameDemo_zzy\SnakeGameDemo_zzy\obj\Debug\SnakeGameDemo_zzy.pdb
文件 1384 2011-12-15 17:53 SnakeGameDemo_zzy\SnakeGameDemo_zzy\Properties\AssemblyInfo.cs
文件 2884 2011-12-15 17:53 SnakeGameDemo_zzy\SnakeGameDemo_zzy\Properties\Resources.Designer.cs
文件 5612 2011-12-15 17:53 SnakeGameDemo_zzy\SnakeGameDemo_zzy\Properties\Resources.resx
文件 1102 2011-12-15 17:53 SnakeGameDemo_zzy\SnakeGameDemo_zzy\Properties\Settings.Designer.cs
文件 249 2011-12-15 17:53 SnakeGameDemo_zzy\SnakeGameDemo_zzy\Properties\Settings.settings
文件 5181 2011-12-15 18:50 SnakeGameDemo_zzy\SnakeGameDemo_zzy\Game.cs
文件 5814 2012-01-14 21:03 SnakeGameDemo_zzy\SnakeGameDemo_zzy\Form1.resx
文件 2704 2012-01-14 21:03 SnakeGameDemo_zzy\SnakeGameDemo_zzy\Form1.Designer.cs
文件 1270 2012-01-14 21:03 SnakeGameDemo_zzy\SnakeGameDemo_zzy\Form1.cs
目录 0 2011-12-15 17:53 SnakeGameDemo_zzy\SnakeGameDemo_zzy\obj\Debug\TempPE
目录 0 2011-12-15 18:00 SnakeGameDemo_zzy\SnakeGameDemo_zzy\bin\Debug
目录 0 2011-12-15 18:40 SnakeGameDemo_zzy\SnakeGameDemo_zzy\obj\Debug
目录 0 2011-12-15 17:53 SnakeGameDemo_zzy\SnakeGameDemo_zzy\bin
目录 0 2011-12-15 17:53 SnakeGameDemo_zzy\SnakeGameDemo_zzy\obj
目录 0 2011-12-15 17:53 SnakeGameDemo_zzy\SnakeGameDemo_zzy\Properties
目录 0 2011-12-15 18:40 SnakeGameDemo_zzy\SnakeGameDemo_zzy
............此处省略4个文件信息
- 上一篇:C#串口MudbusRTU协议编程
- 下一篇:c#图像处理bmp转化为灰度图片
评论
共有 条评论