private bool IsPacmanMakeCollisionWithPills(Rectangle pacmanRect, MoveableGameObject.direction direction) { int radius = 8; Rectangle pacmanMiniRect = new Rectangle(pacmanRect.X + (GameObject.OBJECT_SIZE / 2) - radius, pacmanRect.Y + (GameObject.OBJECT_SIZE / 2) - radius, 2 * radius, 2 * radius); foreach (MagicPillGameObject pill in pills) { if (pacmanMiniRect.Intersects(pill.ScreenRectangle)) { pill.Clear(); return true; } } return false; }
private bool IsPacmanMakeCollisionWithMonsters(Rectangle pacmanRect, MoveableGameObject.direction direction) { foreach(MonsterGameObject monster in monsters) { if (pacmanRect.Intersects(monster.ScreenRectanglePosition)) { if (MonsterGameObject.Ghost) { monster.Kill(); } else { if(! monster.IsDead) return true; } } } return false; }