• 大小: 602KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-08
  • 语言: C#
  • 标签: C#  课程设计  贪吃蛇  

资源简介

本小软件是用C#图形编程的一个贪吃蛇小游戏,程序虽然不美观,也许还有错误,但是程序基本上是没有问题的!都能够运行

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;

namespace GUISnake
{
    class Food
    {
        Point position;     //食物的出现位置
        Boolean exist;      //食物的存在状态

        public Food()
        {
            position = this.creatFood() ;
            exist = true;
        }

        public Point Position
        {
            get
            {
                return position;
            }
            set
            {
                position = value;
            }
        }

        public Boolean Exist
        {
            get
            {
                return exist;
            }
            set
            {
                exist = value;
            }
        }

        public Point creatFood()    //随机创建一个食物返回的值为食物的坐标点
        {
            Point position = new Point(); 
            
            Random ran = new Random();
            position.X = ran.Next(1 33) * 10;
            position.Y = ran.Next(1 30) * 10;

            return position;
        }
        
        public void Draw(Graphics g)  //在传递过来的绘图面板中绘制一个食物
        {
            g.FillRectangle(Pens.Black.Brush position.X position.Y 10 10);
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        913  2008-06-30 09:28  C#贪吃蛇\GUISnake\GUISnake.sln

    ..A..H.     21504  2008-07-05 10:49  C#贪吃蛇\GUISnake\GUISnake.suo

     文件       1361  2008-07-05 10:44  C#贪吃蛇\GUISnake\GUISnake\Food.cs

     文件       4891  2008-07-04 22:02  C#贪吃蛇\GUISnake\GUISnake\Form1.cs

     文件      13108  2008-07-04 22:02  C#贪吃蛇\GUISnake\GUISnake\Form1.Designer.cs

     文件       6385  2008-07-04 22:02  C#贪吃蛇\GUISnake\GUISnake\Form1.resx

     文件       3294  2008-06-30 10:42  C#贪吃蛇\GUISnake\GUISnake\GUISnake.csproj

     文件        913  2008-06-30 09:28  C#贪吃蛇\GUISnake\GUISnake\GUISnake.sln

    ..A..H.     18432  2008-07-03 16:35  C#贪吃蛇\GUISnake\GUISnake\GUISnake.suo

     文件        475  2008-06-30 09:28  C#贪吃蛇\GUISnake\GUISnake\Program.cs

     文件       6047  2008-07-05 10:42  C#贪吃蛇\GUISnake\GUISnake\Snake.cs

     文件          5  2008-07-04 22:54  C#贪吃蛇\GUISnake\GUISnake\temp.txt

     文件       1270  2008-06-30 09:28  C#贪吃蛇\GUISnake\GUISnake\Properties\AssemblyInfo.cs

     文件       2844  2008-06-30 09:28  C#贪吃蛇\GUISnake\GUISnake\Properties\Resources.Designer.cs

     文件       5612  2008-06-30 09:28  C#贪吃蛇\GUISnake\GUISnake\Properties\Resources.resx

     文件       1092  2008-06-30 09:28  C#贪吃蛇\GUISnake\GUISnake\Properties\Settings.Designer.cs

     文件        249  2008-06-30 09:28  C#贪吃蛇\GUISnake\GUISnake\Properties\Settings.settings

     目录          0  2008-07-04 23:20  C#贪吃蛇\GUISnake\GUISnake\Properties

     文件        275  2008-07-05 10:30  C#贪吃蛇\GUISnake\GUISnake\obj\GUISnake.csproj.FileList.txt

     文件        842  2008-07-04 22:02  C#贪吃蛇\GUISnake\GUISnake\obj\Debug\GUISnake.csproj.GenerateResource.Cache

     文件      28672  2008-07-04 22:03  C#贪吃蛇\GUISnake\GUISnake\obj\Debug\GUISnake.exe

     文件        180  2008-07-04 22:02  C#贪吃蛇\GUISnake\GUISnake\obj\Debug\GUISnake.Form1.resources

     文件      58880  2008-07-04 22:03  C#贪吃蛇\GUISnake\GUISnake\obj\Debug\GUISnake.pdb

     文件        180  2008-06-30 13:29  C#贪吃蛇\GUISnake\GUISnake\obj\Debug\GUISnake.Properties.Resources.resources

     目录          0  2008-07-04 23:20  C#贪吃蛇\GUISnake\GUISnake\obj\Debug\TempPE

     目录          0  2008-07-04 23:20  C#贪吃蛇\GUISnake\GUISnake\obj\Debug\Refactor

     目录          0  2008-07-04 23:20  C#贪吃蛇\GUISnake\GUISnake\obj\Debug

     目录          0  2008-07-04 23:20  C#贪吃蛇\GUISnake\GUISnake\obj

     文件      40562  2008-07-03 18:58  C#贪吃蛇\GUISnake\GUISnake\img\12142.jpg

     文件     140351  2008-07-03 18:46  C#贪吃蛇\GUISnake\GUISnake\img\5508e92e0d052b404ec2264c.jpg

............此处省略46个文件信息

评论

共有 条评论