0

I want to make a small game using bash script, The game, at the beginning provides 4 options for users to choose by using the four arrow keys such left, right, down, up.

ex)

1) Join 
2) Sign in
3) Sign out
4) Exit

How can I arrange 4 options above like

1) Join                 2) Sign in

3) Sign out             4) Exit  

and detects the user's arrow keys when in one of them?

3
  • This is beyond plain bash. May 14 at 21:04
  • bash is the wrong language for this. If you want to write some games, you might want to look at pygame, a library for writing games in python with a very active community and hundreds of examples to learn from. Alternatively, look at godot an open source game engine that can be used for games ranging from extremely simple to extremely complicated. It also has a very active community and hundreds of examples. BTW, both pygame and godot have good documentation and tutorials, including video tutorials on youtube.
    – cas
    May 15 at 2:34
  • Both of these are available as packages for most Linux distros so are easily installed. Finally, If they're too complicated for your needs, any language with a decent curses library will do - including python and perl. You could write a really simple game (if it didn't require data structures more complex than scalar variables and simple arrays. and if you didn't mind it being extremely slow) with bash and dialog or zenity or similar, but you really shouldn't - shell is only good for coordinating the execution of other programs. It's terrible at anything else.
    – cas
    May 15 at 2:40

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.