So im making a game and i want my charicter to move diagonaly. I know this can be done with listeners but im not quite sure how. Ive looked through the tutorials and they kind of made sense, but im still confused. so far my script looks like this:
onClipEvent (enterFrame){
if (_root.jethealth <= 25){
this.gotoAndPlay(2);
}
diagonal = new Object();
diagonal.onKeyDown = function(){
var presskey = Key.getCode;
if (presskey == 38 && 39){
this._x += 5;
this._y -= 5;
}
}
Key.addListener(diagonal);
}
I know its wrong and I suspect it could be the “if (pressKey == 38 && 39)”, but im not sure.