java - Need enemyManager to wait between spawning enemies -


I have some different enemy type and enemy manager array list class for each type. I have every kind of enemy, who come to the screen, from the other side, are dying, and reacting randomly. The problem is that when I use a loop to make the objects in the egg, many of them die in the same place in one place with eggs or with each other and then put eggs again. I want to make a delay between them so that they can spread more.

What I see is a way to slow down the robbery of enemies in Java. I tried to expand the name of the enemy manager classes and run the spawn function by the timer but it does not work.

In addition, I am not even multiplying because I do not really know how to set up yet and finish this project without implementing it, but if it is the best solution So I think that I will have to.

Thanks for any suggestions

Renamed .....

  class spawnLgCars TimerTask extended {public zero run} (if (lgCars. Size ()) <10) {lgCars.add (new LGC ()); Println ("created"); } And if (lgCars.size (>> 10) {lgCars.get (0); }}}   

How do I want to implement timeract, but because it was to be in my class, he did not have access to the properties of the examples of LGCS I was using again I tried to extend the LGCER by adding timer work and adding the work to the constructor, but it was not working as well. Not sure why.

TimerTest and one Java. Uil. The timer will not work because it is not set to run the code repeatedly on the swing event thread and should be avoided with swing GUI. Again you should use the swing timer because all the calls to the Timer's ActionListener are called on the swing event thread.

On the other hand, if you have long lasting work, like you want to analyze the image or if it takes a long time to walk, it should be called in the background thread Such as through swingwalker

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -