Beispiel #1
0
        public override void Update(GameTime gameTime, List <Line> Lines, GamePadState gst1, Character enemy)
        {
            enemy.velocity2.X = 0;
            enemy.velocity2.Y = 0;
            KeyboardState ks = Keyboard.GetState();

            //makes sure modifyAttackBox cannot do damage yet
            modifyAttackBox(-300, 500, 20, 100);
            button = gamePadButtons.Update(gst1, 1);
            if (gamePadButtons.newB && mana < 500)
            {
                mana += 2f;
            }
            if (button == Buttons.X && canAttack == true)
            {
                effect.Play(volume, pitch - .2f, pan);
                if (enemy.block == true)
                {
                    blockDamage = 3.6f;
                    mana       -= 10;
                }
                if (mana > 0 && enemy.block == false)
                {
                    mana  -= 22;
                    damage = 15;
                }
                else
                {
                    damage = 0;
                }
                if (facingRight == true)
                {
                    modifyAttackBox(hitbox.X + 100, hitbox.Y, 20, 100);
                    animation.SetTexture(basePunchRight, 0, true);
                    animation.movetexture();
                }
                else
                {
                    modifyAttackBox(hitbox.X - 20, hitbox.Y, 20, 100);
                    animation.SetTexture(basePunchLeft, 0, true);
                    animation.movetexture();
                }
                SomeKeyPressed = true;
            }
            if (button == Buttons.Y && canAttack == true)
            {
                effectHeavy.Play(volume, pitch - .2f, pan);
                if (enemy.block == true)
                {
                    blockDamage = 4.4f;
                    mana       -= 15;
                }
                if (mana > 0 && enemy.block == false)
                {
                    mana  -= 35;
                    damage = 24;
                }
                else
                {
                    damage = 0;
                }
                if (facingRight == true)
                {
                    modifyAttackBox(hitbox.X + 100, hitbox.Y, 20, 100);
                    animation.SetTexture(basePunchRight, 0, true);
                    animation.movetexture();
                }
                else
                {
                    modifyAttackBox(hitbox.X - 20, hitbox.Y, 20, 100);
                    animation.SetTexture(basePunchLeft, 0, true);
                    animation.movetexture();
                }
                SomeKeyPressed = true;
            }
            if (button == Buttons.A && canAttack == true)
            {
                effect.Play(volume, pitch - .2f, pan);
                if (enemy.block == true)
                {
                    blockDamage = 4;
                    mana       -= 13;
                }
                if (mana > 0 && enemy.block == false)
                {
                    mana  -= 29;
                    damage = 21;
                }
                else
                {
                    damage = 0;
                }
                if (facingRight == true)
                {
                    modifyAttackBox(hitbox.X + 100, hitbox.Y, 20, 100);
                    animation.SetTexture(basePunchRight, 0, true);
                    animation.movetexture();
                }
                else
                {
                    modifyAttackBox(hitbox.X - 20, hitbox.Y, 20, 100);
                    animation.SetTexture(basePunchLeft, 0, true);
                    animation.movetexture();
                }
                SomeKeyPressed = true;
            }
            //creates combos makes sure they are in range

            if (Combos.Count > 2)
            {
                if (comboOne[0] == Combos[0] && comboOne[1] == Combos[1] && comboOne[2] == Combos[2] && canAttack == true)
                {
                    if (enemy.block == true)
                    {
                        blockDamage = 3f;
                        mana       -= 5;
                    }
                    if (mana >= 20 && enemy.block == false)
                    {
                        mana             -= 28;
                        damage            = 10;
                        enemy.velocity2.Y = -20;
                    }
                    else
                    {
                        damage = 0;
                    }
                    if (facingRight == true)
                    {
                        modifyAttackBox(hitbox.X + 100, hitbox.Y, 20, 100);
                        enemy.velocity2.X = 7;
                    }
                    else
                    {
                        modifyAttackBox(hitbox.X - 20, hitbox.Y, 20, 100);
                        enemy.velocity2.X = -7;
                    }
                    SomeKeyPressed = true;
                    Combos.Clear();
                }
                else if (comboTwo[0] == Combos[0] && comboTwo[1] == Combos[1] && comboTwo[2] == Combos[2] && canAttack == true)
                {
                    if (enemy.block == true)
                    {
                        blockDamage = 2.4f;
                        mana       -= 3;
                    }
                    if (mana > 0 && enemy.block == false)
                    {
                        mana  -= 19;
                        damage = 8;
                    }
                    else
                    {
                        damage = 0;
                    }
                    if (facingRight == true)
                    {
                        velocity.X        += 7;
                        enemy.velocity2.X += 8;
                        modifyAttackBox(hitbox.X + 100, hitbox.Y, 20, 100);
                    }
                    else
                    {
                        velocity.X        -= 7;
                        enemy.velocity2.X -= 8;
                        modifyAttackBox(hitbox.X - 20, hitbox.Y, 20, 100);
                    }
                    SomeKeyPressed = true;
                    Combos.Clear();
                }
                else if (comboThree[0] == Combos[0] && comboThree[1] == Combos[1] && comboThree[2] == Combos[2] && canAttack == true)
                {
                    if (enemy.block == true)
                    {
                        blockDamage = 5f;
                        mana       -= 6.5f;
                    }
                    if (mana > 0 && enemy.block == false)
                    {
                        mana  -= 8;
                        damage = 12;
                    }
                    else
                    {
                        damage = 0;
                    }
                    if (facingRight == true)
                    {
                        modifyAttackBox(hitbox.X + 100, hitbox.Y, 20, 100);
                    }
                    else
                    {
                        modifyAttackBox(hitbox.X - 20, hitbox.Y, 20, 100);
                    }
                    SomeKeyPressed = true;
                    Combos.Clear();
                }

                //creates a shot that that is based on down left / right and x and also has a timer
                else if (specialShotLeft[0] == Combos[0] && specialShotLeft[1] == Combos[1] && specialShotLeft[2] == Combos[2] && canshoot == true && canAttack == true)
                {
                    if (enemy.block == true)
                    {
                        blockDamage = 1.5f;
                        mana       -= 2;
                    }
                    if (mana > 0 && enemy.block == false)
                    {
                        mana  -= 10;
                        damage = 30;
                    }
                    else
                    {
                        damage = 0;
                    }
                    shotDelay.Start();
                    Shoot();
                    canshoot       = false;
                    SomeKeyPressed = true;
                    Combos.Clear();
                }
                else if (specialShotRight[0] == Combos[0] && specialShotRight[1] == Combos[1] && specialShotRight[2] == Combos[2] && canshoot == true && canAttack == true)
                {
                    if (enemy.block == true)
                    {
                        blockDamage = 1.5f;
                        mana       -= 2;
                    }
                    if (mana > 0 && enemy.block == false)
                    {
                        mana  -= 10;
                        damage = 30;
                    }
                    else
                    {
                        damage = 0;
                    }
                    shotDelay.Start();
                    Shoot();
                    canshoot       = false;
                    SomeKeyPressed = true;
                    Combos.Clear();
                }
            }
            //block
            if (gamePadButtons.newRightTrigger && Jumped == false)
            {
                block          = true;
                canAttack      = false;
                canWalk        = false;
                SomeKeyPressed = true;
                if (facingRight == true)
                {
                    animation.SetTexture(BlockRight, 0, false);
                    animation.movetexture();
                }
                else
                {
                    animation.SetTexture(BlockLeft, 0, false);
                    animation.movetexture();
                }
            }
            else
            {
                block     = false;
                canAttack = true;
                canWalk   = true;
            }
            //Update Bullets
            for (int i = 0; i < Math.Abs(shootlist.Count); i++)
            {
                shootlist[i].Update();
                attackBox = shootlist[i].hitbox;
                if (shootlist[i].hitbox.Intersects(enemy.hitbox))
                {
                    damage = 50;
                    shootlist[i].isvisible = false;
                }
                if (shootlist[i].isvisible == false)
                {
                    shootlist.RemoveAt(i);
                    i--;
                }
            }
            animation.Update(gameTime, hitbox);
            base.Update(gameTime, Lines, gst1, enemy);
        }
Beispiel #2
0
 public void ClearCombos()
 {
     Combos.Clear();
 }