Clamp all berries to screen when resizing window

This commit is contained in:
2025-09-04 19:41:58 -07:00
parent 36078293ae
commit ab5052781a

View File

@@ -407,6 +407,19 @@ public class GamePlayer : MonoBehaviour
{ {
screenWidth = Camera.main.orthographicSize * 2f * Camera.main.aspect; screenWidth = Camera.main.orthographicSize * 2f * Camera.main.aspect;
ClampPosition(bird); ClampPosition(bird);
GameObject[] allberries = GameObject.FindGameObjectsWithTag("NormalBerry")
.Concat(GameObject.FindGameObjectsWithTag("PoisonBerry"))
.Concat(GameObject.FindGameObjectsWithTag("SlowBerry"))
.Concat(GameObject.FindGameObjectsWithTag("UltraBerry"))
.Concat(GameObject.FindGameObjectsWithTag("SpeedyBerry"))
.Concat(GameObject.FindGameObjectsWithTag("CoinBerry"))
.Concat(GameObject.FindGameObjectsWithTag("RandomBerry"))
.Concat(GameObject.FindGameObjectsWithTag("AntiBerry"))
.ToArray();
foreach (GameObject berry in allberries)
{
ClampPosition(berry);
}
} }
GameObject[] normalBerries = GameObject.FindGameObjectsWithTag("NormalBerry"); GameObject[] normalBerries = GameObject.FindGameObjectsWithTag("NormalBerry");
GameObject[] poisonBerries = GameObject.FindGameObjectsWithTag("PoisonBerry"); GameObject[] poisonBerries = GameObject.FindGameObjectsWithTag("PoisonBerry");