Hi,
I’m trying to make an on screen character move using ‘A’ for left, and ‘D’ for right. I’ve managed to make the character move left and right using the left and right keys, using this code:
if (Key.isDown(Key.RIGHT)) {
this_x = this._x + 10;
}
(or something very similar, havent got the code in front of me)
but i dont know how to make it work for other keys. i tried
if (Key.isDown(Key.getCode(65))) {
this_x = this._x + 10;
}
the problem with this is that when you push the A key (ascii code 65) the character starts moving right and doesnt stop. Where as with the previous code, to map it to RIGHT key, he only moves when the key is held down.
id really like to know how to make this work, its messing with my head!!
thanks alot for any help, all appreciated!
Jonny