i can't figure out how to use velocity in scrolling can u help me
Offline
Create two variables: X velocity, and ScrollX. Then put this script:
<when green flag clicked>
<forever>
<if><key[ right arrow ]pressed?>
<change{ X velocity }by( 2 )
<end>
<set{ X velocity }to( (( <{ X velocity }> <*> 0.97 ))
<change{ ScrollX }by( <{ X velocity }>
<end>
Obviously, you can change the if right arrow pressed bit to whatever speed you want!
Offline
ProgrammingAddict wrote:
Create two variables: X velocity, and ScrollX. Then put this script:
<when green flag clicked>
<forever>
<if><key[ right arrow ]pressed?>
<change{ X velocity }by( 2 )
<end>
<set{ X velocity }to( (( <{ X velocity }> <*> 0.97 ))
<change{ ScrollX }by( <{ X velocity }>
<end>
Obviously, you can change the if right arrow pressed bit to whatever speed you want!
I think the last block should be:
[blocks]<set{ ScrollX }to( <{ X velocity }>
[/blocks] not:
[blocks]<change{ ScrollX }by( <{ X velocity }>[/blocks].
Offline
Greenatic wrote:
ProgrammingAddict wrote:
Create two variables: X velocity, and ScrollX. Then put this script:
<when green flag clicked>
<forever>
<if><key[ right arrow ]pressed?>
<change{ X velocity }by( 2 )
<end>
<set{ X velocity }to( (( <{ X velocity }> <*> 0.97 ))
<change{ ScrollX }by( <{ X velocity }>
<end>
Obviously, you can change the if right arrow pressed bit to whatever speed you want!I think the last block should be:
[blocks]<set{ ScrollX }to( <{ X velocity }>
[/blocks] not:
[blocks]<change{ ScrollX }by( <{ X velocity }>[/blocks].
No, it's definitely change by not set to. Say the maximum speed was 6, the scrollx would never be any bigger than six with your way.
Offline
what about the terrain would that be any different if i add velocity
Offline