Jump to content
IGNORED

4 way movement on 8 way sticks.


deepthaw

Recommended Posts

Just curious (since some folks here have probably dealt with it for real):

 

How do games restricted to 4-directional movement (pac-man) deal with handling input from an 8-way stick where diagonals (two directions at once) can happen?

 

I can think of several ways (priority algorithms, simply ignoring diagonals, etc.) but figured somebody could explain firsthand.

Link to comment
Share on other sites

A situation like this I believe would vary from game to game. One approach could be to use the joystick input as an offset for a lookup table to determine the direction to take, and have a predefined direction chosen for all multi-directional inputs. Another approach could be to recognize a multi-directional input is present and mask the input with a random value so that an undefined direction is taken. Another approach could be to determine if one of the directions for the multi-directional input is the current player movement direction, then decide to either continue in that direction or to change directions.

Link to comment
Share on other sites

Usually priorities result into the best result. E.g. when you are moving horizontally while pushing the joystick diagonal, vertical movement becomes priority. And vice versa. That way you can very precisely and pixel perfect corner in a maze.

 

Without these priorities, cornering becomes tedious and/or inaccurate.

Link to comment
Share on other sites

How would you handle priorities if Pac-Man (or any other character) would stand still at the junction? There are several narrow maze games where the character doesn't move automatically, and even situations where diagonal movement is possible at some positions (e.g. open space) but not near walls. In a such game, would diagonals be treated as there is no way, or either axis have preference?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...