TheOuterLinux Mμse - An interesting way to make a text-based game using catimg and play
Posted 06-22-2020 at 05:30 PM by TheOuterLinux
Tags ascii, bash, catimg, commandline, game
Cross-posted from: https://theouterlinux.gitlab.io/Publ...CatimgGame.txt
RSS for website version: https://theouterlinux.gitlab.io/Publ...ticleFeed.atom
The following is a BASH script that with the help of 'catimg' and the 'play' command, you can create a classic text-adventure game but have an image shown just above the text. See notes inside of the script.
RSS for website version: https://theouterlinux.gitlab.io/Publ...ticleFeed.atom
The following is a BASH script that with the help of 'catimg' and the 'play' command, you can create a classic text-adventure game but have an image shown just above the text. See notes inside of the script.
Code:
#Discussion URL: https://www.reddit.com/r/TheOuterLinux/comments/esgvmf/catimg_and_play_to_for_textbased_games/.compact #Grab catimg from https://github.com/posva/catimg #Catimg also supports animated gifs which could be used for fight animations. #Catimg will also automatically adjust the image size, so you might want #to set it to a maximum column width instead (-w #). clear #Clear the terminal screen catimg -w 100 -l 0 "/path/to/intro/image.ext" #Below at the end, the ">&- 2>&-" part hides the player and the final "&" tells it to play this file while also do the next line play "/path/to/intro/music.wav" >&- 2>&- & read -p "What is thy name traveler?: " name clear #Clear screen and then redraw the same image as before catimg -w 100 -l 0 "/path/to/intro/image.ext" echo -n "Welcome $name to this wonderful game!" #You could also add espeak after 'echos' to have narration.
Total Comments 0