I have this code to move my player…
stage.addEventListener(KeyboardEvent.KEY_DOWN,keyboardPress);
function keyboardPress (key:KeyboardEvent):void{
if (key.keyCode == Keyboard.LEFT){
player.x -= 4;
}
}
…however, when the left key is pressed, the player jumps left once, pauses, then continues to move left.
In AS2,
if (Key.isDown(Key.LEFT)){player.x -= 4;}
provided for a much smoother movement.
So, what is the code equivalent in AS3 of the code from AS2 above? Or, in other words, how do I write a smooth keyboard movement code for AS3?
Thanks