pranjaldhole / snake

Snake game written in python using pygame.
https://pranjaldhole.github.io/snake/
MIT License
1 stars 2 forks source link

Controls for the game #2

Open pranjaldhole opened 7 years ago

pranjaldhole commented 7 years ago

We need to figure out a way to add a keymap selection option since some gamers prefer custom designed controls.

symmetryregained commented 7 years ago

Define keymaps in tools.py, perhaps as a dictionary, such that each element gives a list of four pygame keys. Then have update() have an additional argument which will be a list (or four key entries). Then the position update section takes each list element for the direction keys. Order of keys in the list should be the same for all different keymaps.

pranjaldhole commented 7 years ago

I have more in mind that we create a class of four KEYDOWN inputs that can be specified by user and append it to directions. It could be a new file (e.g. utils/custom_keys.py) instead of cluttering tools.py