WindowsbulletBLL/Bullet.cs

(开头部分) 1KB

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Windowsbullet.DAL;

namespace Windowsbullet.BLL
{
    public class Bullet
    {
        //public Class1 c = new Class1();
        public int x;
        public int y;
        public int width;
        public int height;
        public int dx;
        public int dy;
        public int clientWidth;
        public int clientHeight;
        public Random rand;
        public bool getinthescreen = false;//飞入屏幕
        /// <summary>
        /// 构造器
        /// </summary>
        public Bullet() { }
        public Bullet(int clientWidth, int clientHeight, Random rand)
        {
            this.rand = rand;
            this.rand = new Random();
            this.clientHeight = clientHeight;
            this.clientWidth = clientWidth;
            this.x = rand.Next(clientWidth);
            this.y = (-1) * rand.Next(clientHeight);
            this.width = 10;
            this.height = 10;
            this.dx = (-1) * rand.Next(3) + 1;
            this.dy = rand.Next(3) + 1;
        }
        /// <summary>
        /// 先判断是否碰壁,移动一步
        /// </summary>
        public void Move()
        {
            if (this.getinthescreen == false && x > 0 && x < this.clientWidth - this.width && y > 0
                && y < this.clientHeight - this.height)
            {
                this.getinthescreen = true;
            }
            ////左右壁
            if (this.getinthescreen)
            {
                if (x < 0 || x > this.clientWidth - this.width)
                {
                    dx *= -1;
                }
                //上下壁
                if (y < 0 || y > this.clientHeight - this.height)
                {
                    dy *= -1;
                }
后面还有 8 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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