Great tip inquiesco, it is always better to save CPU. By checking every tick you could very well check a few thousand times before the velocity of the character changed. But...you can't just go by input (key/touch). What if the character was moving along and ran into something in the environment (mud/NPC) that affected speed? I would expand on your inout and do it this way:
1) check for input (any)
2) yes? Slow down? Set player instance state to SLOWING
3) no continue check other inputs
...
9) if player instance state != to current state then process
10) is player SLOWING? Yes play animation and Slow
Just my 2 cents.
Actually you could just use the Siginal / Wait for signal also
Thanks —, and you're correct, there could be blocks impeding speed, . In that case I'd make a condition where on key release or on collision with an object and player speed is less than their max speed to play a slower animation like this:
Keyboard -> On key released
player -> On collision with slow_object
---- player -> 8Direction speed < player.8Direction.MaxSpeed
-------- Rest of events