I need help making a script where when you press a key (in this case the D key) it triggers something but when you let go of the D key the thing it triggered stopped and if you press D again the trigger starts again, I need this for a one on one fighting game. Can someone please help me?
Offline
if d key pressed
W
H
E
N
P
R
E
S
S
E
D
C
O
D
E
else (if not d key pressed)
W
H
E
N
N
O
T
P
R
E
S
S
E
D
C
O
D
E
--------------------------------------
Offline
Ok, I got that actual part down but when I press the key the thing it triggers moves really REALLY fast, for instance, I want to make someone move forward and animate to look like he's walking, I have the animate part right, but when I press D (which is supposed to make him move) he moves forward but the animation moves about 5x faster than it should. Any help?
Offline
I think I get what you're trying to say. Try this script:
[blocks]
<when green flag clicked>
<forever>
<if><key[ D ]pressed?>
<repeat until><< <not> <key[ D ]pressed?> >>
DO SOMETHING
<end>
<else>
DO SOMETHING ELSE
<end>
<end>
[/blocks]
Let me know if this isn't what you're looking for - I hope this helps
EDIT: Just read your latest post - try adding a:
[blocks]
<wait( )secs>
[/blocks]
To your script...
EDIT2: The end of the block came out the wrong colour
Last edited by Wolfie1996 (2010-05-16 14:06:29)
Offline
I got this in there already
<wait( )secsc>
because when i take out the key press script and make it where when the game starts hes doing that animation, it works prefectly and with perfect timing, but when i add the key press scripts is when it messes up because in order to make him move properly the part needs to be:
wait 0.1 secs
Last edited by E-RAY444 (2010-05-16 14:13:38)
Offline