Even though you win the 2013 โworst-ever inconsistency between programming language and programโ award, you will fight against rivals such as an x86-based accounting package or a COBOL-based operating system, or anything written in Pascal :-), it will probably be easier for you to simply encode this form directly in a bash script.
It seems that there is no need to separate the form from the code itself.
For the starter, here is a little script that uses tput (curses and terminfo database) to animate your ship at the bottom of the window.
This is not exactly World of Warcraft , but it should be a good starting point. First, we will set up material that never changes, ship strings and bullets, as well as various elements of the screen coordinates:
#!/bin/bash bull1=' * * ' bull2=' ' ship1=' ^ /\ ^ ' ship2=' !__/()\__! ' ship3=' /==: :==\ ' ship4=' (/\/\) ' tput clear ((line1 = $(tput lines) - 6)) ((line2 = line1 + 1)) ((line3 = line2 + 1)) ((line4 = line3 + 1)) ((maxcol = $(tput cols) - 15))
Then we initialize the corresponding variable and introduce an infinite loop:
((bullline = 1)) ((bullcol = 1)) ((curcol = 1)) ((coldir = 1)) while true ; do
Inside the loop, we simply move the sprites, quenching previous values โโand writing new ones. Bullet positions are updated in this section. Please note that we do not need to clear the ship explicitly, as it is surrounded by spaces, which border symbols fade in any case:
tput cup $bullline $bullcol ; echo "$bull2" if [[ $bullline -le 2 ]] ; then ((bullline = line1 - 1)) ((bullcol = curcol)) else ((bullline = bullline - 2)) fi tput cup $bullline $bullcol ; echo "$bull1" tput cup $line1 $curcol ; echo "$ship1" tput cup $line2 $curcol ; echo "$ship2" tput cup $line3 $curcol ; echo "$ship3" tput cup $line4 $curcol ; echo "$ship4"
Then we just update the variables for the ship so that they move left and right, finally lingering a bit so that the animation is smooth:
((curcol = curcol + coldir)) if [[ $curcol -eq $maxcol ]] ; then ((coldir = -coldir)) else if [[ $curcol -eq 1 ]] ; then ((coldir = -coldir)) fi fi sleep 0.1 done
As a result, you get an animation that looks tolerable, given the limitations of the platform:
* * *
^ / \ ^
! __ / () \ __!
/ ==:: == \
(/ \ / \)