Skip to content

Commit

Permalink
can totally go for steam greenlight now
Browse files Browse the repository at this point in the history
  • Loading branch information
Xion committed Aug 23, 2016
1 parent 9d8b363 commit 9646bc8
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 2 deletions.
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# flappybash

Can _you_ beat the Unix pipes?

## Features

* State-of-the-art terminal graphics
* Procedurally generated sound effects
* Adjustable difficulty to challenge beginners and pros alike
* Hours of engaging gameplay

## Requirements

* Pentium processor or higher
* Unix-like operating system with a modern terminal (xterm, UTF-8)
* bash 4.0+ or compatible shell

### Recommended

* Linux operating system supporting ALSA
* Sound Blaster 16 or higher
* Speakers

## Manual

Run it normally:

./flappybash.sh

Press `SPACE` for things to happen.

Press `q` to quit.

You can change the effective screen width by passing an argument:

./flappybash.sh 120

Lower values make the game more difficult. Anything below 80 is probably not for the faint of heart.

## Troubleshooting

#### I only see gibberish, and then the game ends.

Your bash is too old. This most likely means you're running OSX
and you'd want to use Homebrew to install an up to date one:

brew install bash

Check that `bash --version` is at least 4.0 and run the script again.
3 changes: 2 additions & 1 deletion flappybash.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
#!/usr/bin/env bash
# ^ Unlike #!/bin/bash, this shebang will likely find bash 4.0 on OSX if installed.

# FLAPPY BASH
# by Xion
Expand Down
2 changes: 1 addition & 1 deletion release/flappybash.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
#!/usr/bin/env bash
W=${1-`tput cols`};H=`tput lines`;W2=$[W/2];H2=$[H/2];H4=$[H/4];DT=0.05;G=2;K=.;X=2;Y=$H2;VY=0;AY=99;D=0;P=( );PX='';PVX=-99;S=0; a() { case "$K" in q) exit;;*[!\ ]*);;*) VY=-64;K=.;;esac;VY=`_ "$VY+($AY*$DT)"`;Y=`_ "y=$Y+($VY*$DT);if(y<0)0 else if(y>$H)$H else y"`;tY=`t $Y`;PX=`_ "$PX+($PVX*$DT)"`;PX=`t $PX`;if [ $PX -le $X ] && [ ${P[tY]} = '█' ];then D=1;exit;fi;if [ $PX -le 0 ];then ( s 700 0.1;s 350 0.1 )&;S=$[S+1];np;fi;clear;for ((i=1;i<=$H;i++)) do p $PX $i "\e[1;32;49m${P[i]}";done;p $X $tY "\e[1;37;41mB";p `_ "$W2-5"` 2 "\e[1;37;49mScore: $S";( sleep $DT;kill -14 $$ )&}; np() { _u=$[H4+RANDOM%(H2-H4-G)];_l=$[H2+G+RANDOM%(H2-H4-G)];for ((i=1;i<$_u;i++)) do P[i]='█';done;for ((i=$_u;i<$_l;i++)) do P[i]=' ';done;for ((i=$_l;i<=$H;i++)) do P[i]='█';done;PX=$[W-1];}; q() { $p "\e[?12l\e[?25h";tput rmcup;$e -en "\e[0m";if [ $D -gt 0 ];then $e -en "\a";$p "score:$S\ngit gud\n";fi;}; p() { $e -en "\e[$2;${1}f$3";}; s() { ( speaker-test >$n -t sine -f $1 )& _p=$!;sleep $2;kill -9 $_p;}; _() { $e "$*"|bc;}; t() { $p "%.*f" 0 $1;};p=printf;e=echo;n=/dev/null;exec 2>$n;tput smcup;$p "\e[?25l";trap q ERR EXIT;$p "\e]0;FLAPPY BASH\007";trap a 14;np;a;while :;do read -rsn1 K;done

0 comments on commit 9646bc8

Please sign in to comment.