Hi, all! This is my first post on this forum.
I’m working on my first game, and the basic objective is to collect as much trash as you can, but I’m having a little problem. To spawn the objects, I’m checking the level to see if it’s 1, 2, 3, etc. then spawn x amount of objects for that level. But, I don’t want them all to spawn at once, I want to delay part of the code for a certain time so the player can have a chance to catch them all.
Here is the code I’m talking about. http://pastebin.java-gaming.org/0660d2d05521e
Inside of the if statement, are 2 separate sections of code, that spawn the objects, how can I delay the second part by a few seconds. I’ve googled it, but all I can find are people saying to put the thread to sleep, but I don’t want to stop the game completely, just delay a section of code.
Any help is appreciated!