4.)
onClipEvent
(load) {
_root.speed1 = 0;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
_root.ghost._x += _root.speed1;
_root.speed1 -= 0.5;
} else if (Key.isDown(Key.RIGHT)) {
_root.ghost._x += _root.speed1;
_root.speed1 += 0.5;
} else {
_root.speed1 = 0;
}
}
this code says. When the movie clip is loaded, the movieClip
has no set speed.
When the key is pressed, keys left or right, speed will
increase or decrease, and the movie clip will go at
what ever speed it has been set to
If no key is pressed then their is no speed.
. |