Esempio n. 1
0
 public bool checkIfPlayerHitEnemy(Enemy enemy, Player player)
 {
     if (player.playerRec.Intersects(enemy.enemyRec))
     {
         return true;
     }
     return false;
 }
Esempio n. 2
0
        public string checkEnemyLevelCollision(Enemy enemy, Level level)
        {
            string collision = "";
            foreach (Rectangle rectangle in level.levelRec)
            {
                if (enemy.enemyRecRight.Intersects(rectangle))
                {
                    collision += "Right";
                }

                if (enemy.enemyRecLeft.Intersects(rectangle))
                {
                    collision += "Left";
                }

                if (enemy.enemyRecBottom.Intersects(rectangle))
                {
                    collision += "Bottom";
                }
            }
            return collision;
        }