Пример #1
0
        public Player(string fileName, Vector2 spritePosition) : base(spritePosition, fileName)
        {
            sprite.scale = new Vector2(0.3f, 0.3f);

            horizontalSpeed = STANDAR_SPEED;
            shootDelay      = 0.3f;
            cannonOffset    = new Vector2(Width / 2, 0);

            bullet     = Ship.ShootType.STANDARD;
            directionY = 120;

            RigidBody = new RigidBody(sprite.position, this)
            {
                Type = (uint)PhysicsManager.ColliderType.Player
            };

            MaxNrg = 100;
            nrgBar = new Bar(new Vector2(20, 20), "playerBar", MaxNrg)
            {
                BarOffset = new Vector2(4, 4)
            };
            Nrg = MaxNrg;

            poweredUp = false;

            joystickIndex = 0;
        }
Пример #2
0
 public void GetShootPowerUp()
 {
     poweredUp     = true;
     counter       = 0;
     poweredUpTime = POWER_UP_TIMER;
     bullet        = ShootType.TRISHOOT;
 }
Пример #3
0
 public void ChangeBullets()
 {
     if (bullet == ShootType.DIAGONAL)
     {
         bullet = ShootType.VERTICAL;
     }
     else if (bullet == ShootType.VERTICAL)
     {
         bullet = ShootType.DIAGONAL;
     }
 }
Пример #4
0
        public BottomEnemy(EnemyType t, string spritesheetName = "botEnemy", DrawManager.Layer drawLayer = DrawManager.Layer.Playground) : base(t, spritesheetName, drawLayer)
        {
            sprite.FlipX      = true;
            this.Type         = t;
            this.cannonOffset = new Vector2(0, Height / 3);

            float horizontalSpeed = -RandomGenerator.GetRandom(80, 220);

            RigidBody.Velocity = new Vector2(horizontalSpeed, 0);

            this.bullet = ShootType.DIAGONAL;
        }
Пример #5
0
        public void ChangeBullets()
        {
            switch (bullet)
            {
            case ShootType.STANDARD:
                bullet = ShootType.DIAGONAL;
                break;

            case ShootType.DIAGONAL:
                bullet = ShootType.STANDARD;
                break;
            }
        }
Пример #6
0
        public override void Update()
        {
            if (poweredUp)
            {
                poweredUpTime -= Game.DeltaTime;

                if (poweredUpTime <= 0)
                {
                    poweredUpTime   = 0;
                    bullet          = ShootType.STANDARD;
                    horizontalSpeed = STANDAR_SPEED;
                    poweredUp       = false;
                }
            }

            base.Update();
        }