Velocity simply means speed* - I suspect the component that is actually giving you trouble is acceleration, where the speed is gradually increased or decreased instead of being a simple stop/start.
To use acceleration and velocity, you need to replace the command that makes your sprite take a step forward of a fixed amount (eg "move 5 steps") with a command that increases or decreases a variable "speed", and then moves a step of that speed.
EG
[blocks]
<forever>
<if><key[ up arrow ]pressed?>
<change{ speed }by( 1)
<end>
<move( <{ speed }> )steps>
<end>
[/blocks]
If you want the sprite to automatically slow down when not speeding up (the method used in many platformers)
[blocks]
<forever>
<if> <key[ up arrow ]pressed?>
<change{ speed }by( 1)
<else>
<if> <( <{ speed }> <>> 0 )>
. <change{ speed }by( -1)
. <end>
<end>
<move( <{ speed }> )steps>
<end>
[/blocks]
*(For true mathematicians/physicists it actually means speed AND direction)
Last edited by Mayhem (2008-03-16 03:15:55)
Offline