Re: bash 做了个贪吃蛇
发表于 : 2009-08-11 23:09
如何让他可以运行阿。O_O_BOT 写了:看了那个俄罗斯方块弄得
如何让他可以运行阿。O_O_BOT 写了:看了那个俄罗斯方块弄得
dash的错tune 写了:执行不了??
警告信息后倒是可以开始玩,蛇撞墙好像不会死:)O_O_BOT 写了:什么错呢?
代码: 全选
billbear-MacBook:~ billbear$ bash -x ./snake.sh
+ game_with=15
+ game_height=25
+ game_top=2
+ game_left=10
+ game_no_wall=1
+ game_id=0
+ game_sig=0
+ game_start=0
+ sig_up=25
+ sig_left=26
+ sig_right=27
+ sig_down=28
+ sig_exit=32
+ dirt_up=0
+ dirt_down=1
+ dirt_left=2
+ dirt_right=3
+ '[' '' == game ']'
+ key_rountine 86093
+ game_pid=86093
+ bash ./snake.sh game
++ stty -g
+ tty=gfmt1:cflag=4b00:iflag=6b02:lflag=200005cb:oflag=3:discard=f:dsusp=19:eof=4:eol=ff:eol2=ff:erase=7f:intr=3:kill=15:lnext=16:min=1:quit=1c:reprint=12:start=11:status=14:stop=13:susp=1a:time=0:werase=17:ispeed=9600:ospeed=9600
+ echo -ne '\033[?25l'
+ trap 'key_exit;' INT TERM
+ trap 'key_exit;' 32
./snake.sh: line 292: trap: 32: invalid signal specification
+ local key keys sig
+ local ESC
++ echo -ne '\033'
+ ESC=$'\E'
+ keys=(0 0 0)
+ :
+ sig=0
+ read -s -n 1 key
==================================
|| ||
|| ||
||[]./snake.sh: line 245: trap: 32: invalid signal specification
++ key_exit ||
++ stty gfmt1:cflag=4b00:iflag=6b02:lflag=200005cb:oflag=3:discard=f:dsusp=19:eof=4:eol=ff:eol2=ff:erase=7f:intr=3:kill=15:lnext=16:min=1:quit=1c:reprint=12:start=11:status=14:stop=13:susp=1a:time=0:werase=17:ispeed=9600:ospeed=9600
++ echo -ne '\033[?25h' ||
++ kill -32 86093 || Score
./snake.sh: line 282: kill: 32: invalid signal specification
++ clear || ||
|| || Level
|| [] || 0
|| ||
|| ||
|| ||
|| ||
|| ||
|| ||
|| ||
|| ||
|| ||
|| ||
|| ||
|| ||
|| ||
==================================
++ exit
billbear-MacBook:~ billbear$
因为有一个sign 是关联到窗口改变的 所以会这样blueskyevdy 写了:有个BUG, 执行后, 如果改变窗口大小会出现异常情况。
苹果界面不错billbear 写了:警告信息后倒是可以开始玩,蛇撞墙好像不会死:)O_O_BOT 写了:什么错呢?
按 q 退出后,蛇继续在终端里欢快游走
我录制了一段截屏,在这里 http://ubuntu:[email protected]. ... screen.mov
bash -x ./snake.sh 输出: