贪吃蛇.cs

(开头部分) 8KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Design;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Drawing.Printing;
using System.Drawing.Text;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace 贪吃蛇
{
    enum way { up, down, left, right }
    struct point { public int x; public int y;}
    // 下载于www.51aspx.com
    class 蛇身
    {
        public point 坐标;
        public 蛇身(int x,int y)
        {
            坐标.x = x;
            坐标.y = y;
        }
        public 蛇身()
        {
            坐标.x = 0;
            坐标.y = 0;
        }
        public void draw()          //蛇身绘制函数
        {
            SolidBrush brush1 = new SolidBrush(Color.Blue);
            Form1.图.FillRectangle(brush1, 坐标.x, 坐标.y, 10, 10);
        }
    }
    class 蛇头:蛇身
    {
         public new void draw()         //重载绘制函数
        {
            SolidBrush brush1 = new SolidBrush(Color.Red);
            Form1.图.FillRectangle(brush1, 坐标.x, 坐标.y, 10, 10);
         }
         public void move(way w)
         {
             switch (w)
             {
                 case way.up:
                     坐标.y = 坐标.y - 10;
                     break;
                 case way.down:
                     坐标.y = 坐标.y + 10;
                     break;
                 case way.left:
                     坐标.x = 坐标.x - 10;
                     break;
                 case way.right:
                     坐标.x = 坐标.x + 10;
后面还有 190 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。