Re: Java and walking in the game.

When you say it doesn't work, what specifically is happening?
The methods you gave seem as though they should work[1], with some caveats. First, I'm not sure that keyReleased would fire during a Thread.sleep. Second, what causes the action to repeat while the key is down? Are you relying on it constantly firing, or are you using a timer that repeats the walking bit, but with  if(activate) instead?
[1] If you're using Thread.sleep, it should be while nothing at all should be happening during the sleep time. For an example where nothing happens without user input, it's not too bad, but when you try something that is not turn-based, it will be a problem. So yes, it's much better to use timers, even though that means more work just to get walking working.

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : ambro86 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : rkruger via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : ashleygrobler04 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : ambro86 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : ambro86 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : ambro86 via Audiogames-reflector

Reply via email to