Visit Jeremy's Blog.
Go Back > Blogs > TheOuterLinux
User Name


Rate this Entry

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

Cross-posted from:
RSS for website version:

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.

#Discussion URL:

#Grab catimg from
#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.
Posted in Uncategorized
Views 40 Comments 0
« Prev     Main     Next »
Total Comments 0




All times are GMT -5. The time now is 07:15 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration