regex/breakout: Introduce basic paddle

Note that neither the animate script nor this script accept input yet, so
the padding is static.  Rather than relying on spin that would be caused
from moving the paddle, we're just doing a basic adjustment based on the
part of the paddle that is hit (edges change angle).

Eventually the floor will trigger a game-over mode.

* regex/breakout.sed: Add paddle.  Intepret any non-space as ceiling/floor.
breakout
Mike Gerwitz 2018-12-07 23:49:17 -05:00
parent 94280b4f6b
commit 534e18d475
Signed by: mikegerwitz
GPG Key ID: 8C917B7F5DC51BA2
2 changed files with 14 additions and 6 deletions

View File

@ -52,9 +52,17 @@ s/^\( [_-].*\)o\[##\]/\1X /
s/^\([_-] .*\)\[##\]o/\1 X/
# Ceiling, floor
s/^\(.\?-.*_.\{81\}\)o/\1x/
s/^\(.\?_.*\)o\(.\{81\}_\)/\1x\2/
# Paddle sides from top (must do before ceiling/floor)
s/^__\(.*\)o\(.\{81\}<\)/_ \1x\2/
s/^ _\(.*\)o\(.\{82\}<\)/__\1x\2/
s/^_ \(.*\)o\(.\{80\}>\)/__\1x\2/
s/^__\(.*\)o\(.\{81\}>\)/ _\1x\2/
# Ceiling, floor, or middle of paddle
s/^\(.\?-.*[^ ].\{81\}\)o/\1x/
s/^\(.\?_.*\)o\(.\{81\}[^ ]\)/\1x\2/
# Hit wall

View File

@ -1,4 +1,4 @@
- .____________________________________________________________________________.
_ .____________________________________________________________________________.
01 | |
| |
| |
@ -12,12 +12,12 @@
| |
| |
| |
| o |
| |
| |
| |
| |
| o |
| |
| <<=====>> |
| |
| |
| |