void CreatePrisonsAndTanks(int PrisonsToCreate) { float DistanceBetweenPrisons = (EnemyTerritoryMaxX - Background.MinX) / (PrisonsToCreate + 1); for (int PrisonNumber = 1; PrisonNumber <= PrisonsToCreate; PrisonNumber++) { prison = AddSprite<Prison>(); prison.BackgroundLayer = GroundLayer; prison.X = Background.MinX + (PrisonNumber * DistanceBetweenPrisons) + Random.Next(-50, 50); for (int TankNumber = 1; TankNumber <= TanksPerPrison; TankNumber++) { tank = AddSprite<Tank>(); tank.BackgroundLayer = GroundLayer; tank.X = prison.X + Random.Next(-30, 30); tank.init(Level); } } }
void PersonalSpace(Tank TouchingTank) { if (TouchingTank.X > X) { GoLeft(); } else { if (X <= (Scene as PlayScene).EnemyTerritoryMaxX) { GoRight(); } else { GoLeft(); } } }