P2Tank.cs

(开头部分) 2KB

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using Tank_11_14.Properties;
using System.Windows.Forms;

namespace Tank_11_14
{
    //玩家1类
    class P2Tank : Play
    {
        //添加图片资源
        private static Image[] imTank2 = new Image[]
        {
            //使用Resources必须引入 Tank_11_14.Properties;
            Resources.p2tankU,
            Resources.p2tankD,
            Resources.p2tankL,
            Resources.p2tankR
        };
        //初始化地图时构造方法
        //构造函数
        public P2Tank(int x, int y, int life, int speed, direction dr)
            : base(x, y, life, speed, dr, imTank2)
        {

        }
        //键按下的方法
        public void KeyDown(KeyEventArgs g)
        {
            switch (g.KeyCode)
            {
                case Keys.Up:
                    dirU = true;
                    break;
                case Keys.Down:
                    dirD = true;
                    break;
                case Keys.Left:
                    dirL = true;
                    break;
                case Keys.Right:
                    dirR = true;
                    break;
                default:
                    break;
            }
            //如果按下的是W.A.S.D方向键,才开始移动
            if (g.KeyCode == Keys.W || g.KeyCode == Keys.S || g.KeyCode == Keys.A || g.KeyCode == Keys.D)
            {
                isMove = true;
            }
            //按下键后再调用判断的方法
            Adjustdirection();
        }
        //键弹起的方法
        public void KeyUp(KeyEventArgs e)
        {
后面还有 32 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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