I’m using this code right now for a moving background:
onClipEvent (load) {
movespeed = 8;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
_x-= movespeed;
}
if (Key.isDown(Key.LEFT)) {
_x+= movespeed;
}
if (Key.isDown(Key.UP)) {
_y+= movespeed;
}
if (Key.isDown(Key.DOWN)) {
_y-= movespeed;
}
}
but the problem is that pressing combinations of arrows moves the background diagonally (up+left; down+right; etc.)
I do NOT want diagonal character movement at all! I just want up/down/left right. So how do I code this??
Also, is there a better way to write the code above to be shorter?
Thanks!! :megaman_classic: