public BigBullet(double x, double y, double xx, double yy, Game g)
     : base(x, y, xx, yy, g)
 {
     imgName = "bullet1.png";
     speed = 8;
     duration = 100;
     dmg = 2;
 }
 public Bullet(double x, double y, double xx, double yy, Game g)
 {
     game = g;
     posX = x;
     posY = y;
     dirX = xx;
     dirY = yy;
     count = 0;
 }
 public SmallTurret(double x, double y, double a, Game g)
     : base(x, y, a, g)
 {
     imgName = "turret1.png";
     offX = 14;
     offY = 30;
     turnRate = 0.05;
     fireRate = 19;
     range = 450;
 }
 public PlayerTurret(double x, double y, double a, Game g)
     : base(x, y, a, g)
 {
     imgName = "turret0.png";
     offX = 14;
     offY = 30;
     turnRate = 0.08;
     fireRate = 12;
     range = 450;
 }
 public BigTurret(double x, double y, double a, Game g)
     : base(x, y, a, g)
 {
     imgName = "turret2.png";
     offX = 22;
     offY = 67;
     turnRate = 0.05;
     fireRate = 27;
     range = 880;
 }
 public SmallTank(double x, double y, double a, Game g)
     : base(x, y, a, g)
 {
     turret = new SmallTurret(x, y, a * Math.PI / 180, g);
     maxlive = 7;
     live = maxlive;
     offX = 18.5;
     offY = 31.5;
     h = 30;
     w = 18;
     turnRate = 3.4377467708;
     speed = 2.7;
     imgName = "tank1.png";
     radius = Math.Sqrt(Math.Pow(this.w, 2) + Math.Pow(this.h, 2));
     initi = 40;
 }
 public PlayerTank(double x, double y, double a, Game g)
     : base(x, y, a, g)
 {
     turret = new PlayerTurret(x, y, a * Math.PI / 180, g);
     maxlive = 30;
     live = maxlive;
     offX = 18.5;
     offY = 31.5;
     h = 30;
     w = 18;
     turnRate = 4;
     speed = 3.4;
     imgName = "tank0.png";
     radius = Math.Sqrt(Math.Pow(this.w, 2) + Math.Pow(this.h, 2));
     initi = 0;
 }
 public BigTank(double x, double y, double a, Game g)
     : base(x, y, a, g)
 {
     turret = new BigTurret(x, y, a * Math.PI / 180, g);
     maxlive = 25;
     live = maxlive;
     offX = 26.5;
     offY = 47.5;
     h = 46;
     w = 26;
     turnRate = 2.29183118;
     speed = 2.0;
     imgName = "tank2.png";
     radius = Math.Sqrt(Math.Pow(this.w, 2) + Math.Pow(this.h, 2));
     initi = 50;
 }
 public SmallBullet(double x, double y, double xx, double yy, Game g)
     : base(x, y, xx, yy, g)
 {
     imgName = "bullet0.png";
     speed = 6;
     duration = 67;
     dmg = 1;
 }
        private void game_re_start()
        {
            Window.Current.CoreWindow.PointerCursor = new CoreCursor(CoreCursorType.Cross, 1);

            canvas1.Children.Clear();

            cann1 = setCanvas(backimg);
            cann2 = setCanvas(backimg);
            Canvas.SetTop(cann2, 512);
            cann3 = setCanvas(backimg);
            Canvas.SetLeft(cann3, 512);
            cann4 = setCanvas(backimg);
            Canvas.SetLeft(cann4, 512);
            Canvas.SetTop(cann4, 512);

            stopflag = false;
            game = new Game();
            game.player.img = setCanvas(playerImage);
            game.player.turret.img = setCanvas(playerTurImage);
            Canvas.SetZIndex(game.player.img, 2);
            Canvas.SetZIndex(game.player.turret.img, 2);

            for (int i = 0; i < game.houses.Count; i += 1)
            {
                game.houses[i].img = setCanvas(houseImage);
                Canvas.SetLeft(game.houses[i].img, game.houses[i].posX - 45.5);
                Canvas.SetTop(game.houses[i].img, game.houses[i].posY - 72);
                game.houses[i].img.RenderTransform = new RotateTransform() { CenterX = 45.5, CenterY = 72, Angle = game.houses[i].angle };
            }

            timer.Start();
        }
示例#11
0
 public Tank(double x, double y, double a, Game g)
 {
     smokecount = 0;
     game = g;
     posX = x;
     posY = y;
     angle = a;
     dirX = Math.Sin(angle * Math.PI / 180);
     dirY = -1 * Math.Cos(angle * Math.PI / 180);
     act = Act.stop;
     rand = 21;
     flag = true;
     mode = 0;
 }
 public Turret(double x, double y, double a, Game g)
 {
     game = g;
     angle = a;
     targetAngle = a;
     dirX = Math.Sin(angle);
     dirY = -1 * Math.Cos(angle);
     setPosition(x, y);
     count = 0;
     randcount = 0;
 }