first commit
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.old
|
14
colors.sh
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
### Colors ##
|
||||||
|
ESC=$(printf '\033') RESET="${ESC}[0m" BLACK="${ESC}[30m" RED="${ESC}[31m"
|
||||||
|
GREEN="${ESC}[32m" YELLOW="${ESC}[33m" BLUE="${ESC}[34m" MAGENTA="${ESC}[35m"
|
||||||
|
CYAN="${ESC}[36m" WHITE="${ESC}[37m" DEFAULT="${ESC}[39m"
|
||||||
|
|
||||||
|
### Color Functions ##
|
||||||
|
greenprint() { printf "${GREEN}%s${RESET}\n" "$1"; }
|
||||||
|
blueprint() { printf "${BLUE}%s${RESET}\n" "$1"; }
|
||||||
|
redprint() { printf "${RED}%s${RESET}\n" "$1"; }
|
||||||
|
yellowprint() { printf "${YELLOW}%s${RESET}\n" "$1"; }
|
||||||
|
magentaprint() { printf "${MAGENTA}%s${RESET}\n" "$1"; }
|
||||||
|
cyanprint() { printf "${CYAN}%s${RESET}\n" "$1"; }
|
||||||
|
|
||||||
|
printcolor() { printf "${"$1"}%s${RESET}\n" "$2"; }
|
24
death.sh
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
image='trollface.png'
|
||||||
|
source 'colors.sh'
|
||||||
|
prompt="$(redprint "
|
||||||
|
|
||||||
|
▓██ ██▓ ▒█████ █ ██ ██░ ██ ▄▄▄ ██▒ █▓▓█████ ▓█████▄ ██▓▓█████ ▓█████▄ ▐██▌
|
||||||
|
▒██ ██▒▒██▒ ██▒ ██ ▓██▒ ▓██░ ██▒▒████▄ ▓██░ █▒▓█ ▀ ▒██▀ ██▌▓██▒▓█ ▀ ▒██▀ ██▌ ▐██▌
|
||||||
|
▒██ ██░▒██░ ██▒▓██ ▒██░ ▒██▀▀██░▒██ ▀█▄▓██ █▒░▒███ ░██ █▌▒██▒▒███ ░██ █▌ ▐██▌
|
||||||
|
░ ▐██▓░▒██ ██░▓▓█ ░██░ ░▓█ ░██ ░██▄▄▄▄██▒██ █░░▒▓█ ▄ ░▓█▄ ▌░██░▒▓█ ▄ ░▓█▄ ▌ ▓██▒
|
||||||
|
░ ██▒▓░░ ████▓▒░▒▒█████▓ ░▓█▒░██▓ ▓█ ▓██▒▒▀█░ ░▒████▒ ░▒████▓ ░██░░▒████▒░▒████▓ ▒▄▄
|
||||||
|
██▒▒▒ ░ ▒░▒░▒░ ░▒▓▒ ▒ ▒ ▒ ░░▒░▒ ▒▒ ▓▒█░░ ▐░ ░░ ▒░ ░ ▒▒▓ ▒ ░▓ ░░ ▒░ ░ ▒▒▓ ▒ ░▀▀▒
|
||||||
|
▓██ ░▒░ ░ ▒ ▒░ ░░▒░ ░ ░ ▒ ░▒░ ░ ▒ ▒▒ ░░ ░░ ░ ░ ░ ░ ▒ ▒ ▒ ░ ░ ░ ░ ░ ▒ ▒ ░ ░
|
||||||
|
▒ ▒ ░░ ░ ░ ░ ▒ ░░░ ░ ░ ░ ░░ ░ ░ ▒ ░░ ░ ░ ░ ░ ▒ ░ ░ ░ ░ ░ ░
|
||||||
|
░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
|
||||||
|
░ ░ ░ ░ ░
|
||||||
|
|
||||||
|
")"
|
||||||
|
|
||||||
|
choice1="exit"
|
||||||
|
outcome1="menu start.sh"
|
||||||
|
|
||||||
|
choice2="don't exit"
|
||||||
|
outcome2="source youwin.sh"
|
11
explode.sh
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
image='bomb.jpg'
|
||||||
|
|
||||||
|
prompt="It was from Ted Kaczynski."
|
||||||
|
|
||||||
|
choice1="Touch grass."
|
||||||
|
outcome1="source youwin.sh"
|
||||||
|
|
||||||
|
choice2="Become a terrorist."
|
||||||
|
outcome2="source youwin.sh"
|
18
game.sh
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source 'menu.sh'
|
||||||
|
|
||||||
|
run_game() {
|
||||||
|
if [[ $# -eq 0 ]] ; then
|
||||||
|
bash 'intro.sh'
|
||||||
|
sleep 1
|
||||||
|
menu 'start.sh'
|
||||||
|
|
||||||
|
else
|
||||||
|
menu '$1'
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
run_game
|
BIN
images/bomb.jpg
Normal file
After Width: | Height: | Size: 50 KiB |
BIN
images/chad.jpg
Normal file
After Width: | Height: | Size: 39 KiB |
BIN
images/city.jpg
Normal file
After Width: | Height: | Size: 73 KiB |
BIN
images/house.jpg
Normal file
After Width: | Height: | Size: 1.2 MiB |
BIN
images/mail.jpg
Normal file
After Width: | Height: | Size: 56 KiB |
BIN
images/riot.jpg
Normal file
After Width: | Height: | Size: 121 KiB |
BIN
images/trollface.png
Normal file
After Width: | Height: | Size: 59 KiB |
35
intro.sh
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
source './colors.sh'
|
||||||
|
source './menu.sh'
|
||||||
|
source 'print_img.sh'
|
||||||
|
|
||||||
|
clear
|
||||||
|
|
||||||
|
print_img "city.jpg"
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
logo="
|
||||||
|
|
||||||
|
██████╗██╗ ██╗ █████╗ ██████╗ ███████╗
|
||||||
|
██╔════╝██║ ██║██╔══██╗██╔═══██╗██╔════╝
|
||||||
|
██║ ███████║███████║██║ ██║███████╗
|
||||||
|
██║ ██╔══██║██╔══██║██║ ██║╚════██║
|
||||||
|
╚██████╗██║ ██║██║ ██║╚██████╔╝███████║
|
||||||
|
╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝
|
||||||
|
|
||||||
|
████████╗██╗ ██╗███████╗ ██████╗ █████╗ ███╗ ███╗███████╗
|
||||||
|
╚══██╔══╝██║ ██║██╔════╝ ██╔════╝ ██╔══██╗████╗ ████║██╔════╝
|
||||||
|
██║ ███████║█████╗ ██║ ███╗███████║██╔████╔██║█████╗
|
||||||
|
██║ ██╔══██║██╔══╝ ██║ ██║██╔══██║██║╚██╔╝██║██╔══╝
|
||||||
|
██║ ██║ ██║███████╗ ╚██████╔╝██║ ██║██║ ╚═╝ ██║███████╗
|
||||||
|
╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝
|
||||||
|
|
||||||
|
|
||||||
|
"
|
||||||
|
|
||||||
|
cyanprint "$logo"
|
||||||
|
read -p "
|
||||||
|
|
||||||
|
Press [Enter] to continue...
|
||||||
|
|
||||||
|
"
|
13
mail.sh
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
image='mail.jpg'
|
||||||
|
|
||||||
|
prompt="You've got mail!"
|
||||||
|
|
||||||
|
choice1="Open"
|
||||||
|
outcome1="menu explode.sh"
|
||||||
|
|
||||||
|
choice2="Ignore"
|
||||||
|
outcome2="source youwin.sh"
|
||||||
|
|
||||||
|
|
35
menu.sh
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# todo: why /usr/bin/env bash vs /bin/bash?
|
||||||
|
source "./print_img.sh"
|
||||||
|
menu() {
|
||||||
|
clear
|
||||||
|
|
||||||
|
source $1
|
||||||
|
|
||||||
|
print_img $image
|
||||||
|
|
||||||
|
echo -ne "
|
||||||
|
|
||||||
|
$prompt
|
||||||
|
|
||||||
|
What will you do?
|
||||||
|
|
||||||
|
1) $choice1
|
||||||
|
2) $choice2
|
||||||
|
|
||||||
|
Choose 1 or 2: "
|
||||||
|
read -r ans
|
||||||
|
case $ans in
|
||||||
|
1)
|
||||||
|
eval "$outcome1"
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
eval "$outcome2"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Wrong option."
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
9
print_img.sh
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
print_img() {
|
||||||
|
printf "
|
||||||
|
|
||||||
|
|
||||||
|
"
|
||||||
|
|
||||||
|
viu --width 80 "images/$1" | sed -r 's/^/ /g'
|
||||||
|
}
|
||||||
|
|
12
riot.sh
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
image="riot.jpg"
|
||||||
|
|
||||||
|
prompt="Holy shit now you're in a riot!"
|
||||||
|
|
||||||
|
choice1="Panic and run away!"
|
||||||
|
outcome1="menu death.sh"
|
||||||
|
|
||||||
|
choice2="Throw a molotov at the police"
|
||||||
|
outcome2="source youwin.sh"
|
||||||
|
|
13
start.sh
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
image='house.jpg'
|
||||||
|
|
||||||
|
prompt="You are standing in an open field west of a white house, with a boarded front door. There is a small mailbox here. What do you do?"
|
||||||
|
|
||||||
|
choice1="Inventory"
|
||||||
|
outcome1="menu riot.sh"
|
||||||
|
|
||||||
|
choice2="Open Mailbox"
|
||||||
|
outcome2="menu mail.sh"
|
||||||
|
|
||||||
|
|
38
youwin.sh
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
source "colors.sh"
|
||||||
|
image="chad.jpg"
|
||||||
|
print_image() {
|
||||||
|
printf "
|
||||||
|
|
||||||
|
|
||||||
|
"
|
||||||
|
viu --width 80 "images/$1" | sed -r 's/^/ /g'
|
||||||
|
}
|
||||||
|
|
||||||
|
clear
|
||||||
|
|
||||||
|
print_image "$image"
|
||||||
|
|
||||||
|
blueprint "
|
||||||
|
|
||||||
|
|
||||||
|
██ ██ ██████ ██ ██ ██ ██ ██ ███ ██
|
||||||
|
██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██
|
||||||
|
████ ██ ██ ██ ██ ██ █ ██ ██ ██ ██ ██
|
||||||
|
██ ██ ██ ██ ██ ██ ███ ██ ██ ██ ██ ██
|
||||||
|
██ ██████ ██████ ███ ███ ██ ██ ████
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
"
|
||||||
|
|
||||||
|
|