private void SpawnTickets() { int lane = rnd.Next(4); Console.WriteLine(lane); _obOne = new TicketsRoadRacer(_game); if (lane == 1) { _obOne.x = -130; } if (lane == 2) { _obOne.x = 0; } if (lane == 3) { _obOne.x = 130; } LateAddChild(_obOne); TimerForTickets(); }
void Update() { if (_obOne != null) { if (_obOne.y >= game.height) { _obOne.LateDestroy(); _obOne = null; } } if (_opCar != null) { if (_opCar.y >= game.height) { _opCar.LateDestroy(); _opCar = null; } } }