Beispiel #1
0
        public void RightMagicAttack (Player player, Magic magic)
        {

            if (((magic.X + magic.Width / 2) > (player.X - player.Width/2 + 50)) && (magic.X - magic.Width/2 <= player.X - player.Width/2))
            {
                if (!player.AvoidMagicAttack())
                {

                    if ((player.Y + player.Height / 2) >= (magic.Y - magic.Height / 2))
                    {
                        player.DecreaseHealth(magic.Power);

                        if (playerOneMagic == magic)
                        {
                            playerOneMagic = null;
                        }
                        else
                        {
                            playerTwoMagic = null;
                        }
                       
                    }



                    
                }

               
            }
        }
Beispiel #2
0
        public void LeftMagicAttack (Player player, Magic magic)
        {


            if (((magic.X - magic.Width / 2) < (player.X + player.Width / 2)) && magic.X + Width / 2 >= player.X + player.Width / 2)
            {
                if (!player.AvoidMagicAttack())
                {

                    if (player.Y + player.Height / 2 >= (magic.Y - magic.Height / 2))
                    {
                        player.DecreaseHealth(magic.Power);
                        if (playerOneMagic == magic)
                        {
                            playerOneMagic = null;
                        }
                        else
                        {
                            playerTwoMagic = null;
                        }
                        
                    }
                }

               
            }
        }