Guest_imported
New member
- Jan 1, 1970
- 0
Having posted a thread earlier about running in a flash game (thanks for the reply), I've now gone about things in a different way. I've attached the following script to a symbol:
onClipEvent (keyDown) {
if (Key.getCode()==Key.Right) {
_level0.speed = _level0.speed + 1;
}
}
onClipEvent (keyDown) {
if (Key.getCode()==Key.Left) {
_level0.speed = _level0.speed - 1;
}
}
onClipEvent (enterFrame) {
if (_level0.speed < 1) {
_level0.speed = 0;
}
}
This works great - I can speed the object up by pressing the right arrow, and slow it down using the left. However, what I actually want to be able to do is speed the object up based on how quickly the user presses the left and right arrows one after another. Do you remember the Daly Thompson Athletics arcade game? So, if the user is nearly breaking the keyboard hitting 2 keys one after the other, the object will be flying!
Thanks in advance!
onClipEvent (keyDown) {
if (Key.getCode()==Key.Right) {
_level0.speed = _level0.speed + 1;
}
}
onClipEvent (keyDown) {
if (Key.getCode()==Key.Left) {
_level0.speed = _level0.speed - 1;
}
}
onClipEvent (enterFrame) {
if (_level0.speed < 1) {
_level0.speed = 0;
}
}
This works great - I can speed the object up by pressing the right arrow, and slow it down using the left. However, what I actually want to be able to do is speed the object up based on how quickly the user presses the left and right arrows one after another. Do you remember the Daly Thompson Athletics arcade game? So, if the user is nearly breaking the keyboard hitting 2 keys one after the other, the object will be flying!
Thanks in advance!