I'm looking for a technique to help the player navigate a narrow path while the character is in constant motion. When changing direction in junctions, it's pretty hard to time the direction change for a successful turn. With bad timing, the character just gets stuck as pictured.
How can I make this easier for the player? (This is for a university assignment.)
Answer
You could "hot spot"-check areas adjacent to the character
and immediately begin moving in a free direction if the appropriate movement key is held.
For example, if the player is moving right and holds the downward arrow key, they would continue moving right until the below hot spot becomes free. They would then begin moving down.
On platforms that allow multiple directional controls to be triggered simultaneously (such as the arrow keys on a PC), you may want to include an input queue in your control state to ensure the inputs process in order.
The original Pacman used a similar scheme, but even allowed the player to cut corners if they held the controls in the appropriate direction ahead of time like this!
No comments:
Post a Comment