cdrake
06-19-2005, 03:17 AM
Ive got this code that moves a movie clip on the stage.
onClipEvent (enterFrame) {
if (Key.isDown(Key.UP)) {
_y -= _root.carspeed;
}
if (Key.isDown(Key.DOWN)) {
_y += _root.carspeed;
}
if (Key.isDown(Key.LEFT)) {
_x -= _root.carspeed;
}
if (Key.isDown(Key.RIGHT)) {
_x += _root.carspeed;
}
}
The code works like it should but I want to prohibit the user from hitting the LEFT and UP keys together etc. I want it to go up down left right not sideways.
Thanks
onClipEvent (enterFrame) {
if (Key.isDown(Key.UP)) {
_y -= _root.carspeed;
}
if (Key.isDown(Key.DOWN)) {
_y += _root.carspeed;
}
if (Key.isDown(Key.LEFT)) {
_x -= _root.carspeed;
}
if (Key.isDown(Key.RIGHT)) {
_x += _root.carspeed;
}
}
The code works like it should but I want to prohibit the user from hitting the LEFT and UP keys together etc. I want it to go up down left right not sideways.
Thanks