After programming on my game for one day, I finally need some help.What I'm trying to do is: to make my character walk everytime each 200 - 300 ms. I tried this with a thread by letting it sleep for that amount of miliseconds. This actually did work, but not really smooth. Sometimes it didn't really respond to my key input, only after holding it for a certain amount of miliseconds. What is the best way to solve this?Location: https://github.com/Desmaster/Devio/blob/master/src/com/github/desmaster/Devio/entity/Player.java

It's not about delay. The delay you get is just a small side-effect compared to what's to come. You'll need synchronization everywhere just to handle collision detection. No, use an ArrayList, dump in all your objects into it and loop over it and update everyone in order. Don't do it like this, ESPECIALLY not if you don't know why.

Just every time you pass through your loop start off by calling the getTimePassed method to get the number of milliseconds passed since the last call then interpolate your movement and animations based on that.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org