commit 0c6e078a37ab1bc4004df8cd4aa235feb7d090fc Author: creativenothing Date: Sun Aug 14 18:23:24 2022 +0000 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..faa06e2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.old diff --git a/colors.sh b/colors.sh new file mode 100644 index 0000000..6708294 --- /dev/null +++ b/colors.sh @@ -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"; } diff --git a/death.sh b/death.sh new file mode 100644 index 0000000..d4f6035 --- /dev/null +++ b/death.sh @@ -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" diff --git a/explode.sh b/explode.sh new file mode 100644 index 0000000..0e6b6f4 --- /dev/null +++ b/explode.sh @@ -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" diff --git a/game.sh b/game.sh new file mode 100755 index 0000000..5057d92 --- /dev/null +++ b/game.sh @@ -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 diff --git a/images/bomb.jpg b/images/bomb.jpg new file mode 100644 index 0000000..99de70b Binary files /dev/null and b/images/bomb.jpg differ diff --git a/images/chad.jpg b/images/chad.jpg new file mode 100644 index 0000000..26c1cb3 Binary files /dev/null and b/images/chad.jpg differ diff --git a/images/city.jpg b/images/city.jpg new file mode 100644 index 0000000..afbae5f Binary files /dev/null and b/images/city.jpg differ diff --git a/images/house.jpg b/images/house.jpg new file mode 100644 index 0000000..17970ac Binary files /dev/null and b/images/house.jpg differ diff --git a/images/mail.jpg b/images/mail.jpg new file mode 100644 index 0000000..e9ff04a Binary files /dev/null and b/images/mail.jpg differ diff --git a/images/riot.jpg b/images/riot.jpg new file mode 100644 index 0000000..8ff7bf4 Binary files /dev/null and b/images/riot.jpg differ diff --git a/images/trollface.png b/images/trollface.png new file mode 100644 index 0000000..0abf887 Binary files /dev/null and b/images/trollface.png differ diff --git a/intro.sh b/intro.sh new file mode 100644 index 0000000..2dbd327 --- /dev/null +++ b/intro.sh @@ -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... + +" diff --git a/mail.sh b/mail.sh new file mode 100644 index 0000000..5d7154f --- /dev/null +++ b/mail.sh @@ -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" + + diff --git a/menu.sh b/menu.sh new file mode 100644 index 0000000..e44cc10 --- /dev/null +++ b/menu.sh @@ -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 +} + diff --git a/print_img.sh b/print_img.sh new file mode 100644 index 0000000..4072f40 --- /dev/null +++ b/print_img.sh @@ -0,0 +1,9 @@ +print_img() { +printf " + + +" + +viu --width 80 "images/$1" | sed -r 's/^/ /g' +} + diff --git a/riot.sh b/riot.sh new file mode 100644 index 0000000..2da5f0d --- /dev/null +++ b/riot.sh @@ -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" + diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..e62ec45 --- /dev/null +++ b/start.sh @@ -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" + + diff --git a/youwin.sh b/youwin.sh new file mode 100644 index 0000000..90dadd0 --- /dev/null +++ b/youwin.sh @@ -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 " + + + ██ ██ ██████ ██ ██ ██ ██ ██ ███ ██ + ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ + ████ ██ ██ ██ ██ ██ █ ██ ██ ██ ██ ██ + ██ ██ ██ ██ ██ ██ ███ ██ ██ ██ ██ ██ + ██ ██████ ██████ ███ ███ ██ ██ ████ + + + + + + + + + + + + +" + +