Hey, I am making a frogger game and the world is 800, 600
But i've found a code for spawning cars on the interner only I don't understand how I can adapt this to the size of my world.....
This is the code for spawning cars
private void spawnCars() { // Generate a random value to decide in which lane to spawn // a car int randVal = Greenfoot.getRandomNumber(3)+1; // Spawn a single car every 50 acts if (counter % spawnRate == 0) { if (randVal == 1) spawnY = 127; else if (randVal == 2) spawnY = 223; else spawnY = 320; addObject(new Car1(vehicleSpeed), 20, spawnY); autoCount++; } else if (counter % spawnRate == spawnRate / 2) { if (randVal == 1) spawnY = 78; else if (randVal == 2) spawnY = 173; else spawnY = 270; addObject(new Car2(vehicleSpeed), 578, spawnY); // keep track of how many cars on on the screen, so that // you can be sure they all leave the screen before the // Frogger respawns after dying autoCount++; } counter++; }