コード例 #1
0
ファイル: frmFight.cs プロジェクト: PetrovskiIgor/CombatGame
        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;
                        }
                       
                    }



                    
                }

               
            }
        }
コード例 #2
0
ファイル: frmFight.cs プロジェクト: PetrovskiIgor/CombatGame
        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;
                        }
                        
                    }
                }

               
            }
        }