![](https://img.codepudding.com/202009/111575272022251.gif)
![]( https://img.codepudding.com/202009/111575272022252.gif )
To achieve such a function:
Each press movement key, the next role moving a unit of distance, a movement to button again after the next move, namely how to realize the role step by step to walk, not very free move
![](https://img.codepudding.com/202009/111575272022253.gif)
![]( https://img.codepudding.com/202009/111575272022254.jpg )
CodePudding user response:
Basic logic: the player character keys - play character animation - mobile coordinate/vector (a fixed direction distance)Judge branches: character button, the current in the walking state (using function to judge character animation state or the state machine) - cancel moving again,