Пример #1
0
 public void Explode(Effect spawn)
 {
     timeLeft = 0;
     spawn.SetPosition(GlobalTransform.m7, GlobalTransform.m8);
     spawn.Activate();
     explode = true;
 }
Пример #2
0
        public void Init(List<Body> bodys, List<Barrel> barels, int player)
        {
            bodies = bodys; barrels = barels;
            bodyPick = 0;
            gunPick = 0;
            SetBody(0);
            SetGun(0);
            reload = reloading;
            armor = maxArmor;

            if (player == 1) { tankObject.SetRotate(0); }
            if (player == 2) { tankObject.SetRotate(180 * (float)(Math.PI / 180.0f)); }
            tankSprite.SetRotate(-90 * (float)(Math.PI / 180.0f));
            tankSprite.SetPosition(-tankSprite.Width / 2.0f, tankSprite.Height / 2.0f);

            turretSprite.SetRotate(-90 * (float)(Math.PI / 180.0f));
            turretSprite.SetPosition(-10, turretSprite.Width / 2.0f);

            tankObject.AddChild(tankSprite);
            tankObject.AddChild(turretObject);
            turretObject.AddChild(turretSprite);
            turretObject.AddChild(turretSprite);

            tankObject.AddChild(tankTL);
            tankObject.AddChild(tankTR);
            tankObject.AddChild(tankBL);
            tankObject.AddChild(tankBR);
            tankTL.SetPosition(-tankSprite.Height / 2, -tankSprite.Width / 2);
            tankTR.SetPosition(tankSprite.Height / 2, -tankSprite.Width / 2);
            tankBR.SetPosition(tankSprite.Height / 2, tankSprite.Width / 2);
            tankBL.SetPosition(-tankSprite.Height / 2, tankSprite.Width / 2);

            tankObject.myPoints.Add(tankTL.position);
            tankObject.myPoints.Add(tankTR.position);
            tankObject.myPoints.Add(tankBR.position);
            tankObject.myPoints.Add(tankBL.position);

            turretSprite.AddChild(shotFX);
            shotSprite.Load("Resources/shotLarge.png");
            shotFX.AddChild(shotSprite);
            shotFX.SetPosition(turretSprite.Width / 2.0f, turretSprite.Height);
            shotSprite.SetPosition(-(shotSprite.Width / 2.0f), 0);
        }