buzza_gts
11-26-2003, 10:50 PM
I am currently trying to build a simple little game.
This is the first problem that I have come across and am seeking some help.
I want to have a character that will move only once per keystroke.
This is how I move the character:
onClipEvent (enterFrame){
if(Key.isDown(Key.UP)){
this._x +=10;
}
}
When this code is used the character keeps moving if you hold the key down. I would like it so if the key is held down the character will only move 10 pixels and when released and pressed again it will move anouther 10 pixels.
Hope this makes some sense.
Any help appriciated,
Buzza :D
This is the first problem that I have come across and am seeking some help.
I want to have a character that will move only once per keystroke.
This is how I move the character:
onClipEvent (enterFrame){
if(Key.isDown(Key.UP)){
this._x +=10;
}
}
When this code is used the character keeps moving if you hold the key down. I would like it so if the key is held down the character will only move 10 pixels and when released and pressed again it will move anouther 10 pixels.
Hope this makes some sense.
Any help appriciated,
Buzza :D