I am making a new game called Post War and it's a scroller. I want the scrolling to speed up when you hold the arrow key and slow down over time instead of stopping immediately when you release it. Can anyone help me?
Offline
bdn7 wrote:
I am making a new game called Post War and it's a scroller. I want the scrolling to speed up when you hold the arrow key and slow down over time instead of stopping immediately when you release it. Can anyone help me?
[blocks]
<when green flag clicked>
<set{ xvel }to( 0
<forever>
<if><key[ right arrow ]pressed?>
<change{ xvel }by( 0.5
<end>
<if><key[ left arrow ]pressed?>
<change{ xvel }by( -0.5
<end>
<end>
<when green flag clicked>
<forever>
<change{ scrollx }by( (( -1 <*> <{ xvel }> ))
<set{ xvel }to( (( <{ xvel }> <*> 0.95 ))
<end>
[/blocks]
Last edited by HD123 (2010-10-23 20:44:11)
Offline