From 94a424981c3826d776bab2a26158795a220959d3 Mon Sep 17 00:00:00 2001 From: SomeBottle Date: Wed, 15 Dec 2021 19:12:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83=E6=B8=B8=E6=88=8F=E7=BB=93?= =?UTF-8?q?=E6=9D=9F=E9=A1=B5=E9=9D=A2=E6=8E=92=E7=89=88=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9Bonus=E6=95=88=E6=9E=9C=E5=8A=A0=E5=88=86=E4=B8=BA?= =?UTF-8?q?=E4=B8=A4=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- src/game.py | 14 +++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index adf2590..dc911ae 100644 --- a/README.md +++ b/README.md @@ -78,11 +78,11 @@ TUI游戏,一条像贪吃蛇的线。 ## 游戏操作 -* 在**主菜单MENU**使用 ```W``` , ```S``` , ```↑``` , ```↓``` 按键进行选项切换,```ENTER```回车键选定。 +* 在**主菜单MENU**使用 ```W``` , ```S``` 或 ```↑``` , ```↓``` 按键进行选项切换,```ENTER```回车键选定。 * 在**排名表RANKING**中使用 ```A``` , ```D``` 进行翻页, ```ENTER``` 回车键返回。 -* **难度设定DIFFICULTY**界面使用 ```A``` , ```D``` , ```←``` , ```→``` 按键进行困难度调整,```ENTER```回车键返回。 +* **难度设定DIFFICULTY**界面使用 ```A``` , ```D``` 或 ```←``` , ```→``` 按键进行困难度调整,```ENTER```回车键返回。 * 在游戏中使用 ```W``` , ```A``` , ```S``` , ```D``` 或 ```↑``` , ```←``` , ```↓``` , ```→``` 控制角色进行移动。 diff --git a/src/game.py b/src/game.py index db40cd6..98397bd 100644 --- a/src/game.py +++ b/src/game.py @@ -101,7 +101,7 @@ def create_area(cls): map_w, map_h = map(lambda x: x+3, cls.map_size) # 获得地图大小 # 根据地图大小创建游戏区域,要比地图大小稍微大一点 game_area = curses.newwin(map_h, map_w, 1, 1) - msg_area = curses.newwin(8, map_w, map_h+1, 1) + msg_area = curses.newwin(8, 60, map_h+1, 1) game_area.keypad(True) # 支持上下左右等特殊按键 game_area.nodelay(True) # 非阻塞,用户没操作游戏要持续进行 cls.game_area = game_area @@ -220,11 +220,15 @@ def over(self): # 游戏结束 'gameover') # 获得艺术字GAME OVER self.tui.addstr(1, 1, Res.x_offset(over_text, 1)) self.msg_area.mvwin(text_h+1, 1) # 移动一下msg区的位置 - pattern = '{:-^' + str(text_w) + '}' - result_text = pattern.format('RESULT') + pattern1 = '{:#^' + str(text_w) + '}' + pattern2 = '{: ^' + str(text_w) + '}' + result_text = pattern1.format(' R E S U L T ') score, tail_len, total = map(str, self.calc_score()) total_score = float(total) # 总成绩 - score_text = 'SCORE: ' + score+'\nTAIL LENGTH: '+tail_len+'\nTOTAL SCORE: '+total + score_item = pattern2.format('SCORE: ' + score) + tail_item = pattern2.format('TAIL LENGTH: '+tail_len) + total_item = pattern2.format('TOTAL SCORE: '+total) + score_text = score_item+'\n'+tail_item+'\n'+total_item self.msg_area.addstr(0, 0, result_text) self.msg_area.addstr(1, 0, score_text) self.msg_area.addstr( @@ -570,7 +574,7 @@ async def apply(self): # 应用效果 class FxBonus(FxBase): # 得分点效果 async def apply(self): # 应用效果 - Game.add_score() # 只加分 + Game.add_score(2) # 只加分,加两分 name = self.trg_type status = [name, 0] await self.hang_fx(status, True)