Action on Key Hold

Hello,



I would like my charater to keep moving forward as long as i keep my key down. Is there a common a way to do it ?



Thank you

in your update-logic:



if movekey is down
    player.coordinate += player.movementSpeed * timeSinceLastFrame



(assuming you know the jME-syntax for the above)

No it's not what i'm asking, i know how to animate my character the problem is how i know that a key is still hold on ?

How the action off moving a character on a key stroke can be relaunch while keeping the key down ?

voldor said:

How the action off moving a character on a key stroke can be relaunch while keeping the key down ?


That's what I meant by saying you should put it in your update logic. For example, if you're extending SimpleGame you'd put it in simpleUpdate.

Not trying to sound offensive at all, voldor, but you ask a lot of these sort of newbie questions, and I get the feeling you could get answers to them much more quickly by just doing a teensy bit of research on your own. You can start by looking through Furballz.

I hope I'm not making you turn away from jme, it's just that it feels like you are exploiting the goodwill of the community a bit.

Sure you are right, i'll take a look at furlballz. But the problem is that it ends with a core dump each time i launch it from webstart. So it is not easy to test it.



But once again i'll try to search a bit more before posting.



Thanks.



PS: i diid not take it wrong, no problem