//构造函数 public PlaneEnemy(int ET, int x, int y, PlanePlayer PP) : base(GetImage(ET), x, y, GetHP(ET), GetSpeed(ET), Direction.Down) //方向向下,传入玩家飞机位置用于发射锁定子弹 { this.EnemyType = ET; //给敌人类型赋值 planePlayer = PP; r = new Random(x % 7); AimToPlayer(); }
//调用父类构造函数 ////需要确定子弹是哪个飞机发射的 ////获取子弹的xy轴和高宽度,确定子弹要在飞机中前的位置发射 //飞机朝上子弹向上,飞机朝下,子弹向下 public Bullet(PlanePlayer pb, Image img, int speed, int power) : base(img.Width, img.Height, pb.X + pb.Width / 2, pb.Y + pb.Heigth / 2, 0, speed, pb._D) { this.imageBullet = img; this.Power = power; }
internal static Image imagePB = Resources.fire01;//导入玩家子弹图片 public PlayerBullet(PlanePlayer pb, int speed) : base(pb, GetImage(pb.BulletType), speed, 3) { }